Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

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.

 

 

 

 

  • Verified answer
    debugging Profile Picture
    31 on at
    Re: Text Input Default value from colllections

    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 

     

  • debugging Profile Picture
    31 on at
    Re: Text Input Default value from colllections

    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.

     

     

  • Moreshwar Profile Picture
    135 on at
    Re: Text Input Default value from colllections

    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
    Re: Text Input Default value from colllections

    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
    Re: Text Input Default value from colllections

    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);

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1