I have the requirement to merge two or more rown in a grid. An example is shown below:
If the value of col A and col B are same for two rows and Col C value is different then both rows for col A and Col B should be merged.
Discussion posts and replies are publicly visible
Assuming this data is sourced from a database table, the simplest way you can achieve this is by creating a view to merge data across multiple rows using group by clause For e.g. the view query for oracle would be like (here ID is the primary key of the table, you can use any existing columns to order by in this case) -
select COLA, COLB, listagg(COLC,',') within group( order by ID ) MERGED_COLUMN
from ORACLE_TEST4 group by COLA, COLB;
For MySQL DB you can use GROUP_CONCAT().
Once this view is created you can simply source your grid based off this view.
This gets asked a lot, and a quick search came up with at least a dozen different threads containing explanations and design suggestions, for this scenario or ones that are at least similar.
Here's one from just last week where I provided an answer complete with working code sample: community.appian.com/.../86209
Thank you for the explaination. Since I am getting data from the database row by row individually. Please tell me how can I achieve this.
What exactly do you mean by "getting data .. row by row individually"? What is the shape of your data (especially, the relationship of the parent rows with the "sub" rows as per your initial screenshots)? Also -- what have you tried so far, what have you gotten working and what exactly still isn't working? Thus far, you haven't given us much information to work with or even take guesses at.
© 2021 Appian. All rights reserved.