cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MitchelFontys
Frequent Visitor

How to add text from a textbox within a datacard to a collection?

Hey,

For a school project I am currently working on a PowerApp for a professional organization. Within this PowerApp I want to work with collections and a connection to Sharepoint lists. I made a test app and created a simple sharepoint list. In this testapp I have a dropdown that is filled with lastname of the sharepoint list. After clicking the button Collect I add them to a collection and show them in a gallery.

MitchelFontys_0-1639574485246.png

After this I want to use this information in a new collection as you see in the second picture. The gallery on the left shows the collection that I made on screen 1. The labels on the right show the name that I selected. The textfield below is a datacard (form) that represents a column in the sharepoint list. With the button I want to add the Firstname (label), Lastname (label) and Movie Title (textfield in the datacard) to a new collection, but here I encountered some problems. Everytime I try to collect, the firstname and lastname is collected, but the movie title isn't.

The button contains this code:
Collect(Moviecollection;{Voornaam:LabelFirstName.Text; Lastname:LabelLastName.Text;MovieTitle:MovieTitel.Text})

MitchelFontys_1-1639574640965.png

 

I googled a lot and tried some alterations as:
selecteditems, selected.values and just values. I cannot seem to get it working. I have some coding background, but I don't understand how I can extract the text from the textfield in the datacard. Do I have to convert it in some way?

 

EDIT: This is the naming convention of the datacard:

MitchelFontys_0-1639577095216.png


Thank you in advance!

Mitchel

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
CNT
Super User
Super User

@MitchelFontys Your code looks OK. To debug, try this and see what happens,

Collect(Moviecollection;{Voornaam:LabelFirstName.Text; Lastname:LabelLastName.Text;MovieTitle:"MovieTitel"})

View solution in original post

7 REPLIES 7
CNT
Super User
Super User

@MitchelFontys Your code looks OK. To debug, try this and see what happens,

Collect(Moviecollection;{Voornaam:LabelFirstName.Text; Lastname:LabelLastName.Text;MovieTitle:"MovieTitel"})

Hey, tried a couple of iterations. 
I used a empty string: MovieTitle:""})
I tried the example given by you, but this stored "MovieTitel" as a string/text value: MovieTitle:"MovieTitel"})

I also tried this (for no logical reason): MovieTitle:''MovieTitel'}) and: MovieTitle:'MovieTitel'.Text})

 

This all does not store anything in my second collection. 

Is it maybe a smart idea to make another gallery that represents the string in the textinput, so I can see if it takes the right text value from the datacard? This to outscope every possible mistake I am making.

@MitchelFontys 

I tried the example given by you, but this stored "MovieTitel" as a string/text value: MovieTitle:"MovieTitel"})

Well that's exactly what I wanted. So there is nothing wrong in the Collect. It's just that MovieTitel.Text is not returning anything for what ever reason.

Please check the following,

With your original formula, do you see the MovieTitle Column?

If you put MovieTitel.Text in a Label what do you see?

Hey @CNT ,

I did some more research and found out that my value in the textbox is not changing when I fill it in. So that means that my code does exactly what it needs to do, but the textbox does not get a string to pass on to the collection. Now I know that there is not a problem with the collection or the code, but with the textinput not getting the value that I type in. This is not the same problem as the topic was created, but will let you know if I found the problem. 

Thanks for the help! 🙂

@MitchelFontys 

That's exactly what I suspected. 

Try to put MovieTitel.Text in a Label and see what you get.

 

As this is not the same problem as the topic was created, for the benefit of the community,

Please remember to give a 👍 and accept my solution as it will help others in the future.

Hey @CNT 

I tried this. The label stays empty. So that indeed means that the datacard does not pass any data. I also tried this in a new environment and it still does not work. Also tried the set(variable, datacard.text), but that also didn't work. It just won't pass the text that I type in to the datacard value. 

@MitchelFontys You had mentioned that you tried set(variable, datacard.text)

But it should rather be Set(variable, datacardvalue.text), where datacardvalue is your TextInput.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,460)