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

2 REPLIES 2
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?

 

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

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (90,671)