web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Text Input Default val...
Power Apps
Unanswered

Text Input Default value from colllections

(0) ShareShare
ReportReport
Posted on by 31

In Screen OnVisible

ClearCollect( IceCream, { Flavor: "Strawberry", Quantity: 300 } );

UpdateContext({Ice:"hello"});

 

In Text Input

IceCream.Flavor  => "there is an error in this formula"

Ice => This works fine

 

Anything related to get data from a collection seems not to work in a Text input.

How to set the TextBox to a default based on values in a collection?

The use case here is that in onVisible I call a custom connector and need to fill the textbox with a value of the collection that was returned. This textbox value can then be changed by the user and will update the remote server when saved.

 

 

 

 

Categories:
I have the same question (0)
  • Moreshwar Profile Picture
    135 on at

    Hello,

     

    You will have to use LookUp in order to get single row item from a collection to show up in Text control. So your formula should be something like: LookUp(IceCream,Flavor="Strawberry",Quantity);

  • debugging Profile Picture
    31 on at

    Thanks a lot. a bit bad example. The actual collection I work with  with has just an array of name value pairs. (based on a json response). For example, If I change the collection to ClearCollect( IceCream, { Flavor: "Strawberry" }, {Quantity: 300 } ) How to get the value for Flavor.  in the Text Input Default   IceCream.Flavor  gives an error.

    Here is an example where I try to get the text Input use the value of fields from the collection instantiated on OnVisible. When selecting any field it errors out. The same as with IceCream.Flavor. With DropDown boxes using the <collection>.<fieldname> in the item field just  works fine.

    debugging_0-1639383554681.png

     

     

  • Moreshwar Profile Picture
    135 on at

    Hello,

    I am not sure how it will work in this case, but you may try something like collection.AFIT.Value

  • debugging Profile Picture
    31 on at

    This is a very simple and basic use case, get json data from a connector and update from fields, but somehow can't get it to work.

     

    .Value one of the many things I tried. but it failed.

     

    Is this perhaps a bug in Power Apps, since dropdown boxes work fine with <collection>.<fieldname>, Text input, Label and RichText Boxes have the same issue.

     

    I also tried to assign the collection field value to a context variable in the screen onvisible even  but the controls do not allow that variable. for example UpdateContext( { afit: Collection.AFIT});  afit variable is then not accepted in text or default controls (error).  I am out of ideas.

     

     

  • Verified answer
    debugging Profile Picture
    31 on at

    here is the clue http://powerappsguide.com/blog/post/data---how-to-access-nested-collectionstables

    "There is no easy way in Power Apps to access an array based on an indexed position"

    Why PowerApps does not provide something alike Index(Collection,N).<fieldname> ? to get the N'th  data

    More info here Here 

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard