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

Set Variables not working

I have an the following code on the OnVisible property of the screen:

Set(varShowImagebox, false)

 

I have another icon whose OnSelect property has 

Set(varShowImagebox, true)

 

I have a text box for testing purposes whose Text field has

varShowImagebox

 

But when i click on the icon the textbox value does not change.

16 REPLIES 16
WarrenBelz
Super User
Super User

Hi @soumitra ,

You need varShowImagebox as the Visible property of the Text box

 

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.

Visit my blog Practical Power Apps

Tried it, doesn't change. I have it as the text value just to see if the value of varShowImagebox  changes on click of the icon.

@soumitra ,

To be clear,

  1. You have an icon with the OnSelect of Set(varShowImagebox, true)
  2. The value of varShowImageBox is false
  3. It remains false after you press the icon

 

 

 

yes correct, it stays false

@soumitra ,

The only possibility is that you have a context variable with the same name (you have set this)

UpdateContext({varShowImagebox:false})

or you have a bug in the app - try another icon.

 

DeviKrishna
Super User
Super User

Hi @soumitra ,

 

I suggest to try the below.

 

Keep 3 icons - Save, Edit, Cancel

Keep the default Save Icon  Visible : false

Keep the Code on Edit Icon   On SelectSet(varIconVisible,true); 

Keep the Code on Cancel Icon On Select -Set(varIconVisible,false); 

Keep a label  Text : varIconVisible

 

This will work as expected 🙂 You can change the icons as per your need.

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

My Blog: Dynamics 365 Key Topics – https://d365topicsbydk.com/


My Youtube Channel : https://www.youtube.com/channel/UCxSIryP2ah2VpEFr-Z72t1A

Regards
Devi

 

@DeviKrishna ,

Thank you for your input, but it does not explain why the OnSelect of the current icon does not change the value of the Variable.

Hi @WarrenBelz 

I assumed that the variable value was not reset and hence onselect was always showing true.

That's y introduced the cancel icon to reset the variable value to false.

 

If you like my response, please give it a Thumbs Up.

My Blog: Dynamics 365 Key Topics – https://d365topicsbydk.com/

 

My Youtube Channel : https://www.youtube.com/channel/UCxSIryP2ah2VpEFr-Z72t1A

 

Regards
Devi

Hi @DeviKrishna ,

I was just trying to keep on topic as @soumitra has stated the Variable is false and will not set to true (which makes no real sense unless there is something conflicting such as a context variable which will take precedent),

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,729)