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
timl
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (22,502)