Suppose i have a table like this in outsystems:-(The data for this table is fetched through a sql query)
And i need to add the values of all columns in the table based on the subset for the same group i.e. after addition i need a new table which looks like this:-
Where i have added values of all subsets in AP,ABC , ABG based on the subset condition (don't mind the added up values, i have taken random values to illustrate)
so in a nutshell what i need to do is
if Subset='VVEN':
Col1+=col1
and so on for different subsets and display in a new table.
How do i do this ?
Hi Satvik,
If you are performing a SQL operation, then you can do like below.
Create an Output structure
Write the below SQL query and use the structure on the Output
SELECT {SumExample}.[GroupName], SUM({SumExample}.[Col1]), SUM({SumExample}.[Col2]), SUM({SumExample}.[Col3])
FROM {SumExample}
GROUP BY {SumExample}.[GroupName]
Test the query and output will be as below
Data in the entity is as shown below
Let me know if this works for you!!
Regards,
Shree
Thanks for the tip.
can i group them by without using the Group Name column, it isn't present in my data and i need to create it on my own using conditions from subset group
What conditions you need to use? Could you please attach the oml file for reference?
Sorry can't attatch the oml file but the conditions that i need to use are like these:- if subset=Group1Subset2 it belongs to group 1 so i need to create a new column based on subsets and group by the data accordingly
If subset = Group1subset2 then you need to create a new column which will be the sum of Col1 ? Is my understanding correct?
Thanks my problem was resolved
Hello Satvik Srivastava
First you have to group by the name
then right click on col1 , col2 and col3 and click on sum then
Hope this will help you
Regards
Nikhil kumar vijay
Problem is that i don't have this as a static table nor an aggregate, the data inside the table is fetched from a SQL query which is dependent on filters set by user at runtime, so using that table I need to sum up those values and group them. Your solution is appropriate for a static table I guess. I tried using an aggregate in continuation of the refresh SQL widget in the screen action but I can't reference the entire table in that for some reason. Plus I need to bind that table to an existing table on my screen.
What are the possible filters you have on the runtime? You have mentioned only one i.e., if subset = 'VVEN' then Col1+ = col1. Could you please explain more about the filter conditions that you have?
the filters aren't present in the table, VVEN or other subsets are not filters here, they are just columns.