web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to set property va...
Power Automate
Unanswered

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

(0) ShareShare
ReportReport
Posted on by 2

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: http://johnliu.net/blog/2017/7/json-cheatsheet-for-microsoft-flow

 

These are my initialises:

 

 1.png
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}')"

2.png3.png

 

Could someone help me out? 

 

Many thanks. 

Bram

Categories:
I have the same question (0)
  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    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,

  • bramc Profile Picture
    2 on at

    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
    Bram

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 664

#2
Haque Profile Picture

Haque 460

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard