We have a column in a list that allows for multiple lookups to another list.
I tried using the update's default ways first and explicitly providing the Id's. This, of course, worked without any problems
So I tested it out and looked at the Run's result. This is what I see for that column:
I then tried to manually create this json and put it in a compose. Apparently this kind of column only takes arrays, it doesn't take a string variable, but it can take a compose. I tried with the array but that did not work.
So I tried setting it with this manually written json. I used the exact same json from above but the result is just empty
Here's the result:
What's going on here?
Solved! Go to Solution.
Hi @klaw-sha
I was about to offer that option earlier then again I want to see why this is not working. You can still map the final string value to an array. That might do the trick as well.
Thanks for letting me know and glad to hear that its working for you.
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi @klaw-sha
Could you show the steps how you construct the JSON?
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi @klaw-sha
In order to analyse further it would be good to see the steps you constructing (a screenshot).
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogOkay, i must have made a mistake before. But now copy and pasting directly into the compose action works.
This is the result:
But then if I construct the string using dynamic content, it doesn't work. Here is what it looks like:
Textually, we see the input is exactly the same, which is
[
{
"Id": 1
},
{
"Id": 10
}
]
Except I noticed that somehow the Id is appearing as red in the first way when I copied and pasted it into the compose. The second way where the string gets constructed, everything appears black. I wonder why.
This is how I construct the string
I have an Apply to Each for all the values stored in an array variable (in this case, first value is 1 and the second value is 10). I have a variable called "comma", if the variable "counter" is greater than 0 then set "comma" to "," otherwise make it blank. Then set the variable "temp string" to the value of "update json" Then set "update json" to the value of temp string plus the [comma] {"Id": [Current Item] } attached to the end. Then increment the value of "counter"
Then afterwards I add the square brackets before and after. The end result of all this is
[
{
"Id": 1
},
{
"Id": 10
}
]
It seems okay to me! Any idea what I could be missing?
Hi @klaw-sha
Thanks a lot for the detailed screenshot. It really helps to analyse the issue.
Above use the expression int() to convert the current item to integer.
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi @klaw-sha
Also if the integer conversion doesn't work then add a compose and map the JSON string once it constructed. Finally add the output of compose for the update.
Let me know how it goes.
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogThanks for looking at my problem with me. I really appreciate it ❤️
Doing the int conversion on the current item did not help. I think ultimately, the web service just receives json string. Can you explain further what you mean about mapping the json? I don't know what that means. I searched json in the action search and only found "parse json" which i don't think is what we need here. And then I searched for map and only got options for Bing maps.
Through more testing, I've found that it's the copying of the string from a Variable to the Compose action.
If I do this, then it works
And when I do this it does NOT work
Why would the two be different?? This is so frustrating!
After trying so many different things I figured out a solution. I created another variable as an array. I then set this array variable with the following expression: json(variables('update json')). Then I use this array variable in the update item action and it worked! Thank you to abm for trying so hard to understand and give me ideas on a solution. abm is truly a "super user"!
Hi @klaw-sha
I was about to offer that option earlier then again I want to see why this is not working. You can still map the final string value to an array. That might do the trick as well.
Thanks for letting me know and glad to hear that its working for you.
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogUser | Count |
---|---|
101 | |
36 | |
29 | |
25 | |
16 |
User | Count |
---|---|
133 | |
54 | |
53 | |
36 | |
26 |