I am building an array (i think) to be parsed later and i'm questioning the structure that I've used, specifically, how i'm separating 'entry1' from 'entry2'
This is the format i'm looking to achieve in the "ROLLINGUPDATE" field
[{"Date":"SOMEDATE"},{"Time":"SOMETIME"},{"By":"SomePerson"},{"Update":"UPDATES go here"}]
[{"Date":"SOMEDATE"},{"Time":"SOMETIME"},{"By":"SomePerson"},{"Update":"UPDATES go here"}]
[{"Date":"SOMEDATE"},{"Time":"SOMETIME"},{"By":"SomePerson"},{"Update":"UPDATES go here"}]
So i currently have
and if conditions match, i would append to that variable with the contents of the rolling update field
Which currently gives me
[{"Date":"10-Mar-2020"},{"Time":"03:32:57"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:32:49"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:32:39"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:28:30"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:28:23"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:28:17"},{"By":"TestPerson"},{"Update":"First Update"}],
Is my format correct? Specifically i'm wondering about the comma at the end of each line - i'm just not sure if that is appropriate
FYI, if it helps, this is my parsing format
Hi
What I would expect inside an array is a number of similar elements. In your case you are adding objects (that's fine) but each of them have different properties.
Also if you want to create an array via 'Initialize variable' my suggestion is to select as its type 'Array' instead of 'String'.
Please also note there is an action block called 'Append to array variable' that should be used if you declare your variable as array.
An array cannot end with a comma.
Commas shall separate the different elements of an array.
Hope this helps
Proud to be a Flownaut!
Hi @thuff
Yes that comma will be an issue. So to overcome you could initialise an integer count and check if counter > 1 then in your Append string use expression concat with comma and rollingupdate else just use the rollingupdate. Also make sure in your initialise WeeklyUpdateString do not use any comma at the end.
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogThank you @abm and @efialttes ,
Clearly I was confused on the structures. I have long had a basic misunderstanding between arrays & objects - i think i recall the key difference being that (by and large) arrays assume order and objects do not. For these purposes, i think ( and i'm willing to be wrong!) that restating the variables as arrays is the logical approach and start by redefining the structure of that first variable as object. e.g.
{"Date":"@{formatDateTime(utcNow(),'dd-MMM-yyyy')}","Time":"@{formatDateTime(utcNow(),'HH:mm:ss')}","By":"TestPerson","Update":"@{triggerBody()?['Status_x0020_Update']}"}
I will play with this and let you know - thank you both (and please let me know if that sounds crazy!)
Hi again
Your new approach sounds more common nowadays.
Since you get confused sometimes with arrays and objects, I would recommentd the following link for better understanding of arrays...
https://sharepains.com/2018/07/10/microsoft-flow-shed-some-light-on-arrays/
...and this other link for better understanding of objects in JSON format
https://sergeluca.wordpress.com/2017/11/23/using-json-in-microsoft-flow-part-1/
Please note this second link has a typo, when Serge says:
...what he really wants to say is:
Hope this helps
Proud to be a Flownaut!
hi @efialttes ,
That is supremely helpful and both make a lot of sense. entertaining reads. After i read those i thought 'oh i just need to join objects' but now after reading the articles again, i think i need to parse objects , grab the body as an array, append to array.
Or perhaps there is such thing as just append to object?
Proud to be a Flownaut!
Proud to be a Flownaut!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
27 | |
26 | |
23 | |
14 | |
10 |
User | Count |
---|---|
62 | |
55 | |
29 | |
28 | |
24 |