cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ICM
Advocate II
Advocate II

Multiple Variables

Is it possible to set more than one variable at a time?

 

e.g.

 

updatecontext({VarTemp1: 1, VarTemp2: "Test"})

 

or does every variable have to be set individually?

 

Thanks for any assistance in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
v-monli-msft
Community Support
Community Support

Hi @ICM,

 

According to https://docs.microsoft.com/en-us/powerapps/functions/function-updatecontext:

UpdateContext( { ContextVariable1: Value1 [, ContextVariable2: Value2 [, ... ] ] } )


ContextVariable1 - Required. The name of a context variable to create or update.
Value1 - Required. The value to assign to the context variable.
ContextVariable2: Value2, ... - Optional. Additional context variables to create or update and their values.

 

It should be supported to create multiple context variables in one formula.

 

Example:

UpdateContext( { Name: "Lily", Score: 10 } ) 

Creates or modifies the context variables Name and Score, setting their values to Lily and 10 respectively. Name has the value Lily, and Score has the value 10.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
JRaasumaa
Memorable Member
Memorable Member


@ICM wrote:

Is it possible to set more than one variable at a time?

 

e.g.

 

updatecontext({VarTemp1: 1, VarTemp2: "Test"})

 

or does every variable have to be set individually?

 

Thanks for any assistance in advance.


 

If you try putting your code (with uppercase UpdateContext) on a button and place 2 text boxes with the Text property set to VarTemp1 and the other to VarTemp 2 what happens when you push the button?

 

v-monli-msft
Community Support
Community Support

Hi @ICM,

 

According to https://docs.microsoft.com/en-us/powerapps/functions/function-updatecontext:

UpdateContext( { ContextVariable1: Value1 [, ContextVariable2: Value2 [, ... ] ] } )


ContextVariable1 - Required. The name of a context variable to create or update.
Value1 - Required. The value to assign to the context variable.
ContextVariable2: Value2, ... - Optional. Additional context variables to create or update and their values.

 

It should be supported to create multiple context variables in one formula.

 

Example:

UpdateContext( { Name: "Lily", Score: 10 } ) 

Creates or modifies the context variables Name and Score, setting their values to Lily and 10 respectively. Name has the value Lily, and Score has the value 10.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

this is not working

UpdateContext({varStatus:"Awaiting Initial input"[,varStatus:"Not Started"]})

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,916)