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

Saving the index of a dropdown selected value to local variable or hidden label

@RandyHayes You brought up an interesting point in my other ticket.  So I thought I'd open this for an explanation.  When the dropdown items are filtered as they are below...All the resulting columns from that view are still usable.

tonykiefer_0-1636052884694.png

 

So the resulting dataset for the dropdown list is this.  The dropdown list displays the PLM_BOM_RESULT.

tonykiefer_1-1636052993405.png

 

If I selected the 4th record in the dropdown...

Component_Change_Combobox

tonykiefer_0-1636053760518.png

and If I wanted to preserve the "Seq" or AX_ItemID and save it to a local variable or hidden label from that selection...How would that look?  

 

When you mentioned this is my previous ticket I had an "Ah Ha" moment and this made me realize a cool feature down the road in my development.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@tonykiefer 

Well, you really don't need to put it in some variable....it is already there!

 

At ANY point that you want, you can reference Component_Change_Combobox.Selected.Seq or Component_Change_Combobox.Selected.AX_ItemID and it will have the value you want.

 

Adding it to a variable means you need to manage that variable all the time because it is a snapshot and will not change on its own.

Adding it to a hidden label is a waste because that would just reference the combobox to then reference the label.  Cut the middle-man and just go to the combobox selected column value you want at any time.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@tonykiefer 

Well, you really don't need to put it in some variable....it is already there!

 

At ANY point that you want, you can reference Component_Change_Combobox.Selected.Seq or Component_Change_Combobox.Selected.AX_ItemID and it will have the value you want.

 

Adding it to a variable means you need to manage that variable all the time because it is a snapshot and will not change on its own.

Adding it to a hidden label is a waste because that would just reference the combobox to then reference the label.  Cut the middle-man and just go to the combobox selected column value you want at any time.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
tonykiefer
Super User
Super User

@RandyHayes quick and easy!  That's the way I like it.  This is a great little tidbit that I am partially aware of in that I know I can access the datapoint as such Component_Change_Combobox.Selected.Seq...but KNOWING that I can use it later on the page (I'm assuming the page hasn't refreshed and the value is infact cached, somewhere) is a valuable learning point.  You should make a quick little video on this.  Viewers will dig it for sure!  It's the little things like this that are eye-poppers.

tonykiefer
Super User
Super User

@RandyHayes ...it's an eye-popper because you could then use that datapoint to drive values in other fields...like a cascading dropdown list for instance.

RandyHayes
Super User
Super User

@tonykiefer 

It is actually more than that...it is global.  You can access that value from anywhere in your App!  Controls are global.  So, if you have another screen and want to reference something about that selected Item, you can do so.

 

Yes...I actually have some simple tips and tricks videos on my video's to make list.  I've been way behind on them *sigh*  I just need more time in every day!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,559)