I have a collection with a single request in it. Iām using a .csv with collection runner to execute the request once per line in the .csv. The first column in the .csv is āDocument IDā, and thatās the only variable Iām using from the .csv.
However, at the bottom of the .csv is a blank line followed by a few lines that arenāt pertinent to the running of the collection.
Iād like the collection to see the blank line (pm.collectionVariables.get(āDocument IDā) == āā) and stop executing.
Any suggestions on the best way to do that?
Not sure this is possible, as setNextRequest(null) only sets the request that will run next.
It doesnāt trigger immediately.
Therefore, you can check if the element is empty in a pre-request but its still going to run that request.
My suggestion would be to transform the CSV file so its in the correct format to start with. (This is always my suggestion for this type of task, as Postman is not an ETL tool).
I know its another language, but Iād probably do this in PowerShell first as it has native cmdlet support for CSV files. Import the CSV, filter out blank lines and the other lines and then Export-CSV.
Get PowerShell to pick up the file from the source, and then save it to the folder that Postman will pick it up from.