Sum values on table record and how to get total amt
Application Type
Traditional Web

Hello software engineers,

I'm trying to sum values on table record . How can I achieve total amt?I used two entities.I desire dynamically calculate the total of the above table record  1st to 15th days on the 15th day of every month if I filter with Year and Month.I created local variable for total i.e cumulative and implemented foreach iteartion and finally assign cumulative.But it didn't work. Can I receive checking oml? 

Regards,

Hayasaka

@Hayasaka Kenichi 

Please check if it is the correct behavior.

I have to remove some code in order to publish, so be aware of it will damage something on your side.

I advise you to merge the code that is only on the SaleScreen. 

Meanwhile, you can test it here before doing something: https://galmeida.outsystemscloud.com/SalesManagement/SaleScreen.aspx?_ts=637523545438876910


Regards

Gonçalo Almeida

SalesScreenSumOfMultipleRecordext.oml

Hi Hayasaka ,

Do you want to sum the two values from different entities based on selected year?

Please confirm.

If you want to sum multiple records then you can do it by add "total amount= first value" in second iteration add "Totalamount =total amount + second value" 

Regards,

Komal

Hi,

Please find attached OML for sum of two records from different entity, you can user your year filter in entity then you can do the logic as in OML. You can find it in sumdemo screen.

Regards,

Komal 

Sum.oml

Hi  Komal, Thanks for sending sample oml.I refered this. I want  to sum 1st day to 15th day of  records on same entity and want to output  total as same relative column based on filter year and month.I tried your oml. But I have many records and coumns , if I used this  foreach  iteration,looping will not finish. 

Thanks Komal,

Best Regards 

Hayasaka 

mvp_badge
MVP

hi Hayasaka ,

you can use single entity for get SUM total record and use one entity to show all record .

also add same filter in both entity . so whenever you filter the record data will be same.

or You can advance Sql for it.


Hope this will help you.

Regards

Rahul

Hi Hayasaka ,

You can use two Aggregate in preparation for fetching data. One will fetch  record for table and another will use for find total. Both aggregate will have filter by Year and month and you can set aggregate Max record value 15.

It is better to use Aggregate a column  than 'for loop' for finding sum. 

I made a sample web app with similar use case. You can explore it.


Thank you. Hope this may help you.

Sumvaluesontablerecord.oml

Hi Rahul, thanks for sending sample oml.

I tried it.  I don't understand why you put expression in this total column. If so, when I filter with year and month, this date expression will not work even I filtered in aggregate. After reading  Aggregate a column docs,I did as your instruction but if condition didn't work in this total column. For instance as in screenshot below.I desire 1st day to 15th days sales amt with multiple values , finally want to show total of 15th day sale amt .This is my expectation.According to @Rahul Sahu suggestion, it's similar to @Rahul Kumar instruction.For that, thanks to  @Rahul Sahu .I will attach oml.Please can I receive check?

Thanks Rahul Kumar

Best Regards,

Hayasaka

SalesScreenSumOfMultipleRecord.oml

Hi Heyasaka,

I wanted to understand logic that should possible in your case by oml. 

Section that showing Totals of columns. where 1st column is Date and it should be up to 15th Date of month. 

In your 2nd image.

I wanted to show total only when data is available in your table. Otherwise what's sense to show totals. That's why i enclosed  container in If condition.


Your Oml is not publishing in my environment. That's why i am unable to check. But I changed many things according to my understanding. Please test it in your environment. It help u to solve your problem.

 


SalesScreenSumOfMultipleRecord22.oml

Hi Rahul  Kumar, I understood your explanation. When I  try to test, it occurs as Internal Error due to database conversion failed. Anyway, I was really understood your logic. It helped me. I achieved @Goncalo Almeida's oml.Thanks you so much. 

Best Regards,

Hayaska

Hi @Hayasaka Kenichi

You can use what @Rahul Sahu suggested, however, if you can share your oml it would be easier to help you.

Regards

Gonçalo Almeida


Thanks Goncalo, I did above comment's instruction but not yet achieve. I attached oml in above . Please Can I get check?

Regards,

Hayasaka

SalesScreenSumOfMultipleRecord.oml

@Hayasaka Kenichi 

Please check if it is the correct behavior.

I have to remove some code in order to publish, so be aware of it will damage something on your side.

I advise you to merge the code that is only on the SaleScreen. 

Meanwhile, you can test it here before doing something: https://galmeida.outsystemscloud.com/SalesManagement/SaleScreen.aspx?_ts=637523545438876910


Regards

Gonçalo Almeida

SalesScreenSumOfMultipleRecordext.oml

I checked your upgrade oml. Really worked. Thanks you Goncalo.

Best Regards,

Hayasaka

Champion

Hi Hayasaka,

In my case, I think you can create common server actions with input fruit type, year and month.

In this server action you can do aggregate group by and filter by the fruit type, year and month. It will return total amount in its ouput.

In your pages, you can put expressions and use this server actions in each of the summary column. It is cleaner and it will not mix up with your screen preparation aggregate.


Hope it helps

Regards

Thanks ronny.I will try.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.