cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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.

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Dynamically Create Arrays. and store data as required.

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.

Highlighted
Helper I
Helper I

Re: Dynamically Create Arrays. and store data as required.

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.

Highlighted
Community Support
Community Support

Re: Dynamically Create Arrays. and store data as required.

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

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

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

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Users online (9,743)