cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

What means [@VariableName] syntax?

Hello,

 

I'd like to ask you the meaning of [@VariableName]  syntax and which is the difference with normal VariableName?

 

Thank you

7 REPLIES 7
Super User III
Super User III

Hi @Anonymous

The technical name for the @ symbol infront of VariableName is the 'global disambiguation' operator. An @ symbol infront of a variable will always return the value of the global variable.

On a screen for example, let's say we set a global variable with the Set function, and a context variable with the UpdateContext function. In both cases, we provide the same variable name (MyVariable).

Set(MyVariable, "Tim"); 
UpdateContext({MyVariable:"Mr Dang"})

In this example, [@MyVariable] would return "Tim", whereas MyVariable would return "Mr Dang".

 

 

Anonymous
Not applicable

Thnk you for your reply.

 

OK, now I understand why my pager not works.

 

I declared a variable in screen OnVisible with Set:

 

 

Set(myParams, {pageIndex:0, [...other params]})

And on OnSelect of next page button I wrote:

 

 

 

UpdateContext({myParams:Patch(myParams,{pageIndex:myParams.pageIndex+1})});[...other refresh result code]

 

So now I have two different myParams variable with the same name but different values.

 

Is possible to use Patch function without UpdateContext?

 

Thank you

 

Yes, it's possible to call Patch without nesting it inside a call to UpdateContext.

 

Anonymous
Not applicable

How it should be the function?

I've tried the following but not works:

Patch(myParams,{pageIndex:myParams.pageIndex+1})

Hi @Anonymous

Could you clarify a bit more as to what you're trying to acomplish here, particularly on how you want to reset the pager? I assume that's why you're resetting a variable on the OnVisible of your screen? Is there any reason why you couldn't just use a single variable to do this, rather than 2 variables?

Hi @Anonymous,

 

Just from the testing, it seems currently Patch() function will not work with Variables, patch() function currently could work with Collection, Data source, but not for Variables, even the variable is defined as a table value.

So if here you would like to take use of the Patch() function, then please consider switch the Set(Variable, value) with collect() or ClearCollect() function.

For Example:

 

Clearcollect(MyParams,{Record})

Then use patch to update its value with the format below:

 

 

Patch(MyParams, first(MyParams), {UpdateValue})

If here you prefer to use variable, to update the variable value, please consider switch to:

 

Set(MyParams, {Value})

Note here, if you use the Set() function, for the {Value} part,  the whole record should be entered, even if there is no changes for the related fields.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for your help with this thread @timl and @v-micsh-msft 

 

@Anonymous can you review the updated information and advise?

 

@Anonymous

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,847)