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 / Issue with SET command...
Power Apps
Unanswered

Issue with SET command in OnVisible - variable is not "recognized"

(0) ShareShare
ReportReport
Posted on by 122

Hi all,

 

I have problem with Set in following case.

SelectedLanguage - is global variable 

It is "green" in IsEmpty (recognized as variable), in Set commands (bold) it is not in "green" and SET does not work...

 

What is "funny", is when you write the variable name behind semicolon it is recognized, but it is obviously incorrect syntax.

 

PowerApps.pngPowerApps2.png

 

If((Or(Left(Language();2) = "en";Left(Language();2) = "cs") && IsEmpty(SelectedLanguage));
 Set(
 SelectedLanguage;
 Left(
 Language();
 2
 )
 );
 Set(
  SelectedLanguage;
 "en"
 )
);;

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @TomasZubov 

     

    You might want to consider replacing your IsEmpty with IsBlank as in this case you are trying to determine if the variable is blank, not if it is empty.  IsEmpty on "" will always be false.  IsBlank on "" will always be true.

     

    I hope that is helpful for you.

  • TomasZubov Profile Picture
    122 on at
    Thank you I will correct that, but evaluation is not the problem. Problem is set, that does not work and does not matter whether it is true or false.....
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @TomasZubov 

    Are you saying that nothing gets set in the variable?  According to your formula (with the IsEmpty) in it, it will always have "en" in it.

    I have tried that exact formula (with the IsEmpty and IsBlank) to test, and in noth instances, the variable ends up with "en".  Of course, my language setting is EN anyway so I suspect it to be.  But if I alter the first Set to show something different just to test, the formula works just fine.

     

    Also, just to be sure, make sure you don't have any Context variables on that screen called SelectedLanguage.  Having a context of SelectedLanguage and a Global of SelectedLanguage is posisble in PowerApps, but causes a lot of confusion.

  • v-xida-msft Profile Picture
    on at

    Hi @TomasZubov ,

    I have made a test, and the issue is confirmed on my side. The screenshot as below:8.JPG

     

    It is the normal color rendering representation of Variable within PowerApps Studio for web.

    When you initialize/update a variable within PowerApps Studio, the color of the Variable name would be the default color -- Black. Only when you use the initialized Variable within other formulas, the color of the VariableName would be rendered as a different color (Global variable rendered as "Green", Context variable rendered as "Blue").

     

    If you want the color of the Variable name to be rendered as corresponding color when you initialized/updated the variable, I afraid that there is no way to achieve your needs in PowerApps currently.

    If you would like this feature to be added in PowerApps, please consider submit an idea to PowerApps Ideas Forum:

    https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

     

    Best regards,

  • Community Power Platform Member Profile Picture
    on at

    Thanks for posting in the community @TomasZubov. Can you review the above replies and update the thread if they were helpful?

     

    Thank you,

     

    @Anonymous 

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard