cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AnthonyPhan
Kudo Kingpin
Kudo Kingpin

Nested Concat

Hi All,

I am using the Concat function to generate a HTML table based on a collection. This is similar to what is being done here. For my application It would be very nice to have a concat funcation nested inside another Concat funcation (similar to having a for loop inside another for loop in C). However Im not sure how to reference the 'Result' of the child Concat.

 

For example:

if we have table a and b below:

Table A Table B
1 a
2 b
3 c



and I try to do this:
Concat( A, concat(B,  "A:" & Result & " B: " & Result & "<br /> ")

I hope to get something like:
A: 1 B:a
A: 1 B:b

A: 1 B:c
A: 2 B:a
A: 2 B:b
A: 2 B:c
A: 3 B:a
A :3 B:b
A :3 B:c


How can i distinguish A.Result from B.Result?? At the moment Result will always reference the result of the parent Concat.

1 ACCEPTED SOLUTION

Accepted Solutions
mr-dang
Community Champion
Community Champion

 

You can use RenameColumns() to rename the Result for either of them.

 

Assuming your formula is already working:

Concat(A, Concat(RenameColumns(B,"Result","Result_B"),  "A:" & Result & " B: " & Result_B & "<br /> ")

The renaming is not permanent and is only scoped to the formula.

 

Let me know if this works for you.

Microsoft Employee
@8bitclassroom

View solution in original post

3 REPLIES 3
mr-dang
Community Champion
Community Champion

 

You can use RenameColumns() to rename the Result for either of them.

 

Assuming your formula is already working:

Concat(A, Concat(RenameColumns(B,"Result","Result_B"),  "A:" & Result & " B: " & Result_B & "<br /> ")

The renaming is not permanent and is only scoped to the formula.

 

Let me know if this works for you.

Microsoft Employee
@8bitclassroom

Cheers! this worked perfectly.

lmheimendinger
Resolver III
Resolver III

I have been playing with a test app.  Here is how I am collecting records that look like what I can use.

 

ClearCollect(colSO, ShowColumns(Filter(SalesOrders, ShipDate=varDate), "Driver_x0020_Name", "CustomerRef_FullName", "Cust_x0020_Contact", "RefNumber", "ShipDate"));
ClearCollect(colSOCopy, colSO);
ForAll(colSOCopy, Patch(colSO, ThisRecord, {Cust_x0020_Contact:"<tr><td>" & Cust_x0020_Contact & "</td>", CustomerRef_FullName:"<td>" & CustomerRef_FullName & "</td>", RefNumber:"<td>" & RefNumber & "</td>"}));
ClearCollect(colGrp,GroupBy(Filter(colSO, ShipDate=varDate),"Driver_x0020_Name", "grpSO")); RemoveIf(colGrp, IsBlank(Driver_x0020_Name));
ClearCollect(colGrpCopy, colGrp);
ForAll(colGrpCopy, Patch(colGrp, ThisRecord, {Driver_x0020_Name:"<tr><td>" & Driver_x0020_Name & "</td></tr>"}));

 

This is what I have in a text field which in turn is HTMLTEXT for an HTML text object:


<!DOCTYPE html>
<html>
<body>
<table th>
" & Concat(colGrp,Driver_x0020_Name) & "
</table>
<table>
"

This correctly gives me the parent table

 

lmheimendinger_0-1655244250520.png

But try as I might, I cannot figure out how to not only add the orders collection but to do so interspersed in the rows of the parent table.  I bet it's more straightfoward than what I have been trying.

 

My colSO looks like this which is what I expect.  In each grpSO, there are item records and each contains JUST the columns from the ShowCoumns expression, and <tr><td> has been added to the beginning of each column and </td></tr> to the last column end with </td> ending the other columns (see after col

 

lmheimendinger_2-1655244824348.png

lmheimendinger_3-1655244918604.png

So I have the basics figured out but the end result seems as far away as ever.  This boils down to a single question:

 

How do I format expression(s) in the text field that will yield the correct HTML result, which is a driver row in a table followed by the items for that driver in an embedded table for the items in the associated collection?  I know HTML supports tables within tables but having difficulty mapping Power Apps into HTML that will do that.  Below is what the Power App galleries look like in the app, and I am striving for a similar look in the PDF>

 

lmheimendinger_4-1655245426257.png

 

 

 

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,137)