Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Multi-line checkbox to table to modified data in new column

(0) ShareShare
ReportReport
Posted on by 11

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>
Categories:
  • CK-22072023-0 Profile Picture
    CK-22072023-0 11 on at
    Re: Multi-line checkbox to table to modified data in new column

    Well - I certainly was overcomplicating the solution. That is exactly the expected results. Thank you very much!

  • Verified answer
    CU-18081211-6 Profile Picture
    CU-18081211-6 9,261 on at
    Re: Multi-line checkbox to table to modified data in new column

    @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:

    gabibalaban_0-1643641365169.png

    Hope it helps !

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard