
Hi Team,
how to loop column values and extract them into a text(in one row) separated by coma, based on the city.
we have a table
| City | Villages |
| c1 | v1 |
| c1 | v2 |
| c1 | v3 |
| c2 | v1 |
| c2 | v2 |
| c3 | v1 |
Expected values in the gallery like
| City | Vill |
| c1 | v1,v2,v3 |
| c2 | v1,v2, |
| c3 | v1 |
Please help me.
your reply is really appreciated with example.
@v-bofeng-msft
Hi @Anonymous ,
I've made a test for your reference:
I assume there is a table
ClearCollect(
ComTest,
{City:"c1",Vill:"v1"},
{City:"c1",Vill:"v2"},
{City:"c1 ",Vill:"v3"},
{City:"c2",Vill:"v1"},
{City:"c2",Vill:"v2"},
{City:"c3",Vill:"v1"}
)
Add a Gallery and set it's items property to:
GroupBy(ComTest,"City","New")
Add a Label in Gallery and set it's Text property to:
If(
CountRows(ThisItem.New) > 1,
Left(
Concat(
Filter(
ComTest,
City = ThisItem.City
),
Vill & ", "
),
Len(
Concat(
Filter(
ComTest,
City = ThisItem.City
),
Vill & ", "
)
) - 2
),
First(
Filter(
ComTest,
City = ThisItem.City
)
).Vill
)
Best Regards
Cheng Feng