cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User III
Super User III

Re: What means [@VariableName] syntax?

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

 

 

Highlighted
Anonymous
Not applicable

Re: What means [@VariableName] syntax?

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

 

Highlighted
Super User III
Super User III

Re: What means [@VariableName] syntax?

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

 

Highlighted
Anonymous
Not applicable

Re: What means [@VariableName] syntax?

How it should be the function?

I've tried the following but not works:

Patch(myParams,{pageIndex:myParams.pageIndex+1})
Highlighted
Super User III
Super User III

Re: What means [@VariableName] syntax?

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?

Highlighted
Community Support
Community Support

Re: What means [@VariableName] syntax?

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.
Highlighted
Anonymous
Not applicable

Re: What means [@VariableName] syntax?

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,967)