cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Oskarkuus
Super User
Super User

How to collect data from textinputs?

I have this code:

 

ClearCollect(
    colText1;
    ForAll(
        Split(TextInput1.Text; Char(10));
        {
            Text1: Result            
            
        })
        
        
)

 

 

It works great. It takes all values from textinput1 and create a collection, one row for each new row in the textinput box.

 

But now i want to duplicate this code and at the same time add data from another textinput.

So i did this:

 

Clear(colText1);;
ClearCollect(
    colText1;
    ForAll(
        Split(TextInput1.Text; Char(10));
        {
            Text1: Result            
            
        });

        ForAll(
        Split(TextInput1_1.Text; Char(10));
        {
            Text2: Result            
            
        })
        
        
)

 

 

But then the collection looks like this.

This is not the result i am after. I want them to be side by side. So i can with one button collect several textinputs to one collection and keep the order that the textinputs have.

 

Oskarkuus_0-1619341856466.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Oskarkuus ,

This is not nearly as easy as you might think and I answered a similar question a week or so ago and ended up writing a blog on it. Note I have free-typed this, so you might have to clean up commas/brackets etc, but the structure you need is below

Clear(colText1);;
With(
   {
      wList:
      ForAll(
         Split(
            TextInput1.Text; 
            Char(10)
         );
         {Text1: Result}
      )
   };
   Collect(
      colText1;
      Patch(
         Last(
            FirstN(
               wList;
               Value
            )
         );
         {RowNo1: Value}
      )
   )
);;
Clear(colText2);;
With(
   {
      wList:
      ForAll(
         Split(
            TextInput1_1.Text; 
            Char(10)
         );
         {Text2: Result}
      )
   };
   Collect(
      colText2;
      Patch(
         Last(
            FirstN(
               wList;
               Value
            )
         );
         {RowNo2: Value}
      )
   )
);;
Clear(colText3);;
Collect(
   colText3;
   AddColumns(
      colText1;
      "Text2";
      LookUp(
         colText2;
         RowNo2 = RowNo1
      ).Text2
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

1 REPLY 1
WarrenBelz
Super User
Super User

Hi @Oskarkuus ,

This is not nearly as easy as you might think and I answered a similar question a week or so ago and ended up writing a blog on it. Note I have free-typed this, so you might have to clean up commas/brackets etc, but the structure you need is below

Clear(colText1);;
With(
   {
      wList:
      ForAll(
         Split(
            TextInput1.Text; 
            Char(10)
         );
         {Text1: Result}
      )
   };
   Collect(
      colText1;
      Patch(
         Last(
            FirstN(
               wList;
               Value
            )
         );
         {RowNo1: Value}
      )
   )
);;
Clear(colText2);;
With(
   {
      wList:
      ForAll(
         Split(
            TextInput1_1.Text; 
            Char(10)
         );
         {Text2: Result}
      )
   };
   Collect(
      colText2;
      Patch(
         Last(
            FirstN(
               wList;
               Value
            )
         );
         {RowNo2: Value}
      )
   )
);;
Clear(colText3);;
Collect(
   colText3;
   AddColumns(
      colText1;
      "Text2";
      LookUp(
         colText2;
         RowNo2 = RowNo1
      ).Text2
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,001)