I am very new to PowerApps and do not have my head wrapped around the syntax yet.
The issue I am trying to solve is to get the text of each row of a multi-line text box, then manipulate the text to generate three new rows in a different text box.
Multi-line control "txtDataIn" contains "A", "B", "C", each on their own row in the textbox. I want to transform that data into three new rows that will ultimately display in another multi-line control names "txtDataOut". The output for each row in "txtDataIn" would be:
<TheName Value="A">
<ActualName>A</ActualName>
</TheName>
I am not sure of the best way to implement this. I know I need to get the data out of txtDataIn and get it where I can reach each row. I accomplished this step by using the following code:
ClearCollect(
colTextIn,
Split(
txtDataIn.Text,
Char(10)
)
I am stuck on how to the second part. In C# I would grab the current value, I think "ThisRecord" in PowerApps and build the three new rows by appending the text as shown above. I store the resulting string (<TheName Value="A"> CrLf <ActualName>A</ActualName> CrLf </TheName>) in a variable then insert that into the second text box.
I know I will need a ForAll section. But I am at a loss as to what to put in it to get ThisRecord, build the strings with the CRLF, and insert the results into the txtTextOut.
I could make the TextOut target a table. However, I ultimately need to copy all of the restructured strings as text to paste into a target XML file. This means that the end result of the process would be to copy the text example below and paste it into NotePad as shown below:
<TheName Value="A">
<ActualName>A</ActualName>
</TheName>
<TheName Value="B">
<ActualName>B</ActualName>
</TheName>
<TheName Value="C">
<ActualName>C</ActualName>
</TheName>
Well - I certainly was overcomplicating the solution. That is exactly the expected results. Thank you very much!
@ckelsoe ,
Check this out:
With(
{rows:Split(TextInput1.Text,Char(10))},
Concat(
ForAll(rows,
"<TheName Value="""&Result&">"&Char(10)&" <ActualName>"&Result&"</ActualName>"&Char(10)&"</TheName>"&Char(10)),Value))
Try to use it in the Text property of the second textinput control. If I correctly understood your request it should look like:
Hope it helps !