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 Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,874)