Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

How to set property value on a object-type variable?

Hi all


I'm stuck with the following problem:

I would like to change a property value of an object-type variable. 

I read this amazing blog:


These are my initialises:


Here I would like to change the value of the property "test". 
As you can see, I would like to use the value of variable "dc", as the name of the property. 

This works, but using the value of the variable not..

"@json('{\"test\": 2}')"



Could someone help me out? 


Many thanks. 


Community Support
Community Support

Re: How to set property value on a object-type variable?

Hi @bramc,


Could you provide more details about your needs?

Obviously, using variables here instead of property names is not in line with the specification.

There is no similar way to set the property value in the article.

It seems that you can only reference property names to set property values. And the property name compulsory is a constant, you cannot use variables.


Best Regards,

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

Re: How to set property value on a object-type variable?

Hi Barry


Thank you for your answer. 


This was just a little test, because I have a "big" program where I would've liked to implement this. 

The program does the following:


I have a Sharepoint List with a lot of data (points from the evalutions of the students at school).

Each evaluation belongs to a theme. There are like 20 different themes. 
In the SP list, there are columns like studentnumber, theme, score, maximum_score, ...


I iterate through each student, and within this iteration I iterate through each SP list item from this student. 

At this moment, I have many variables (for each theme a variable total_score, total_max_score) and many conditions and switch cases.. All the initialises, and the resets after each iteration..

The flow is getting too big, at this point each action I want to make takes like 5 seconds to appear.

In the end, I need to calculate all the percentages from each theme and make reports. 


That's why I hoped to get this working. 
If this would be possible, I can get a SP list item, check the 'theme' and then iterate through all the SP list items with the same theme (from the specific student). And then write the percentage to the variable-object. 

Then I would only need 2 variables instead of 20, and much less conditions and cases.. 


My object-variable would be initialised like this and I would overwrite the property value of each theme (if the theme was evaluated): 


"theme_1" : 0,

"theme_2" : 0,


"theme_20": 0



I hope you can make me a bit wiser, because it's not easy anymore. 


Many thanks

Helpful resources


Super User Program Update

Three Super User rank tiers have been launched!


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,284)