Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Dynamically Create Arrays. and store data as required.

NOTE: I can create this report using other means, but I am using this as means to further my understanding, knowledge and expertise of Flow.


I am working on building a report style flow - we have a text file that is appened to each time a user logs into a machine. the data we store is PCName, Username and Date/Time.


Report requirement: Produce a tailored email to each person identified in the list with the time they logged into their PC on a weekly basis.


Current Progress: I have created a variable of the target day, and I have a routine that converts splits each line of data (PCName, Username, DateTime) into an array, further splits each line into another array of each element, a further array that splits the DateTime and compares the date to our target date to see if we need to do anything.


The Problem: How do I create further arrays dynamically for each identified user? there could be 30 entries or 40 depending on attendance? I need to create an array for each user, within that array add a date and time of their "first" login - the solution if there is one would need to check to see if an array exsists before adding to it and creating one if it doens't.


I suspect this might be a little too complex for Flow at present, but hopefully i'm wrong...


Thank you in advance.

Community Support
Community Support

Hi @ScottCooper ,


Unfortunately, there is no way to initial array variables dynamically. For example, I want to create multiple arrays according to the records of data, I may need the Apply to each action or Do until action, but if I put the initial variable action into it, it will return an error that The operation 'Initialize variable' can only be used at the top level.Annotation 2019-09-06 143243.png

You can consider storing each row into a SharePoint list, the use the Get Items action to get each record, the process the string of each records into an array, then do the further step.Annotation 2019-09-06 143424.png

Annotation 2019-09-06 144024.png

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for your reply, as this is a training excercise so to speak i'm trying to do this entirely within Flow just to make it that much harder.


But for a practical solution sharepoint lists do look a good route, and will be soemthing I deploy in the future. You have sparked an idea however. Rather than looping through once collecting data for all agents, it at first glance seems possible to loop through multiple times for each specific agent, after a little array filtering.

Hi @ScottCooper,


Yes, since the data is stored in the text file and its type is String, so it's difficult to parse.

And cause the records are multiple, so we need to stack in a loop to process it after split the data. For some consideration, each time store it needs to empty the temp SharePoint list.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,217)