cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Australia
Post Patron
Post Patron

Why my variable value on a label only shows on the second go?

Hi PA veterans,

 

I have a series of onStart global variables coded in the following fashion:

Set(varClientName,  "");

Set(varClientEmail,  ""); etc

 

I want to click the 'Show Info' button and see the the value of varClientName on the label. For testing purpose, I've created a label  to check if the value is returned correctly (original gallery.selected value vs. the variable value). However, the value of varClientName 'John Smith' will only appear on the second click. This is the same for all my other variables. May I know where I've done wrong and how to fix it?

PA issues.jpg

 

Thank you in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Australia correct

 

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.




​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

10 REPLIES 10
PowerRanger
Resident Rockstar
Resident Rockstar

@Australia 

Have you tried closing and re-opening the App? I tried this on my side exactly as you described and I can't reproduce your issue. 




​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.

@Australia Did it re-opening the app solved your issue

 

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.




​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.

@PowerRanger Thanks for the help. 🙂
I might have finally figured it out.  I think I have too many set variables in the OnSelect of the button so I used the 'Concurrent' function to bundle all the set variables and it appears to have worked. 🙂
e.g. Concurrent(
Set(galClientName.Selected.ClientName.DisplayName,varClientName),
Set(galClientName.Selected.ClientEmail.Email,varClientEmail),

......

);

 

Hope this post helps anyone who have experienced similar issues in the future.

 

@Australia is there a specific reason why you store each value in a single variable?

 

Why don’t you save the complete record into a single variable?

 

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.




​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.

@PowerRanger because I am an amateur... 😂  Could you kindly teach me how I can save the complete record into a single variable?  Let me know if I need to update the OnStart global variables, too. 🙂

 

@PowerRanger hi again, no unfortunately. I tried multiple times, re-starting the app did not solve the issue.

@Australia 

You could just write

Set(varSelectedItem,galClientName.Selected)

 

This will save the entire record in a variable and you can reference it anywhere you want. This formular could be used in the OnSelect property of your Gallery. In That case (using theOnSelect Property of your Gallery) you could even say

 

Set(varSelectedItem,ThisItem)

 

So now, on a label Text-Property you could say e.g. 

 

varSelectedItem.ClientName.DisplayName

 

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.




​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.

@PowerRanger Wow amazing!

So just to confirm here is what I need to do:

1. App OnStart  -  do nothing

2. Gallery OnSelect - Set(varSelectedItem,ThisItem)

3. Button OnSelect - Set(varSelectedItem,galClientName.Selected)

4. Label Text - varSelectedItem.ClientName.DisplayName or varSelectedItem.ClientEmail.Email or varSelectedItem.ClientPhone so on and so forth?

 

@Australia correct

 

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.




​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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,821)