Hello Everyone,
I want my amount will show if total amount is 0 or greater than 0 . otherwise I don't want to show data . if the amount is less then 0 (in -).then I want to delete that row from table automatically .
please help me to figure out from this issue.
Thanks in advance.
your faithfully Mubasshir Shaikh
Hi @MUBASSHIR SHAIKH, to show data where the total amount is greater than or equal to zero, just create a filer in your aggregate.
Entity.TotalAmount >= 0
And as for automatically deleting values with less then 0, you can create a timer with required logic.
Okay I'll try.
Thanks Gitansh Anand
Hi,
If you don't want to keep the negative values in your database I would suggest you to not store itself in the first step. While saving the data check the condition Entity.Amount >=0 then only you proceed for saving.
1. Anyways to delete the existing records from your database if it is only one time that you do then include a button on your screen DeleteNegativeValues and put an SQL in the delete action to delete the negative amount from the table. Inside the SQL you can fetch the negative amounts to delete for reference find the below screenshot, If you want to delete the records on a scheduled basis like daily/weekly/monthly/yearly then you can use the same server action logic in your timer with the schedule of your own.
2. Now to fetch the amount only with positive values, put a condition in your aggregate Entity.Amount >= 0 which would return all the positive amount values from the aggregate. Find the attached screenshot for your reference,
Hope this helps!!
Regards,
Shree
Hello MUBASSHIR SHAIKH
To show the amount only if the total amount is greater than or equal to 0, you can use a conditional expression in the expression editor of the UI element where you want to display the amount. The conditional expression should check if the total amount is greater than or equal to 0, and only display the amount if it is. For example, if the total amount is stored in a variable called TotalAmount, you could use the following expression to display the amount:
If(TotalAmount >= 0, Amount, "")
This expression checks if TotalAmount is greater than or equal to 0. If it is, it displays the value of the Amount variable. If not, it displays an empty string, effectively hiding the amount.
To delete rows with negative amounts automatically, you can use an aggregate filter to filter out any rows with negative amounts. In the aggregate, add a filter that checks if the Amount is greater than or equal to 0. This will exclude any rows with negative amounts from the aggregate, effectively removing them from the table.
To summarize, you can achieve the desired functionality by:
Using a conditional expression to display the amount only if the total amount is greater than or equal to 0.
Using an aggregate filter to exclude rows with negative amounts from the table.
Hi ,
While fetching the data through aggregate , you can make a filter on amount coloumn, and can put the condition amount>0. It will return only those records who is having the >0 value.
For deleting the records from table: Create a timer and write advance sql to delete from [table_name] where amount <0 .
While saving the data check if amount<0 then show error message and dont save into the table.