Showing results for 
Search instead for 
Did you mean: 
New Member

Name "export to csv" from a variable not in the collection?

I am trying to create an inventory app for my department, although i'm starting with a scanner for our incoming equipment, which will save the list as an excel sheet of what we received and send a copy off to who needs to have it. All of that is good except for saving it. I want the name to be the PO order, which right now is in the main screen of the app, they type in the PO number, then choose the equiptment type, and then the model of that equiptment, then start scanning serial numbers. The collection stores the, serial, model, type, whoscanned, whenscanned, and as of right now the ponumber.


Although, i dont want the PO number in the collection, i only included it so i could use it to name the file. This causes errors as it's trying to save to the same file name over and over within the foreach it automatically puts it in because the name is coming from a collection.... Is there a way to send over to flow the variable for the ponumber separate from the collection. So i can convert the collection to a svc, then name it the PO Number? 


I just tested it, scanned in a bunch of power adapters, then started a new list and scanned in a bunch of laptops and that failed. They are on the same PO and i didnt realize, the problem is i tried to simple change the "PO Number" to something like PONUMBER-Laptops, and that did not work since it was coming from the collection. So i had to clear the collection and rescan with the new po number. 


I really hope this is possible. Thank you in advance for your help.

Super User III
Super User III


Can you provide a few more details on some of your formulas and where you are seeing the problem?

In general, you can collect all the PO's you want and associated items.  It will be how you send this to PowerAutomate that will be the area of focus.

Tell more about how your Flow is set up and what parameters it takes.  Then formulas you have for how you are executing that Flow.

Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes



This is my flow, it was the best way i could figure out how to convert my collection to a csv then save it to a sharepoint (teams directory). When i'm sending over the collection now to power automate, the compose is taking in just the collection.

Set(varFormatedJSON, JSON(collectMultiScan, JSONFormat.IndentFour));

I'm not sure how to include another variable (the PO_Number) to send to power automate. 


The way this works is they put in the po number, then choose the type and model, then hit scanned list which opens to a gallery and a "scan" button. They scan it adds to the gallery. 


collectMultiScan contains the Type, Model, Serial Number, ScannedBy, WhenScanned, and PO_Number on each item. I would like to remove the PO_Number from each item and only use it to save the file when i'm using export to csv in powerautomate. 


Hopefully i answered your question. And thank you again for you help.





So is your flow intended to deal with only ONE PO at a time?  If you are passing the PO number in the collection, then you can certainly have your Flow use that to create/update the PO associated with that item in the collection.


If not, then you will need to group your Collection by the PO and then send the items to the flow in a ForAll to process single PO Items only.


    ExportCSV.Run(JSON(POItems, JSONFormat.IndentFour))


Two things:

1) I am assuming the names of the columns PONumber and POItems in your collection - replace as appropriate.

2) This will not include the actual PO Number in the POItems.  I would suggest that you have another parameter on your Flow that is for the PO number, then you would just include that in your formula - ExportCSV.Run(PONumber, JSON(POItems, JSONFormat.IndentFour))



Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

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.

Top Solution Authors
Top Kudoed Authors
Users online (2,211)