I have a flow that is scraping data from the target website and creates a data table. I want to run a for each row in the data table, if the price is less than 300, then it will write to an excel that says cheap products. otherwise it will write to an excel that says expensive products. my automation is flowing but nothing is outputting. What do I need to do with my condition building differently?
So you need to use cdbl(currentrow("Pricecolumnname").ToString.Trim) > 300
If the price value contains any special characters like $ or so we need to hndle them
Currently what you are doing is just to create a variable of type integer and when no value is given the value will be 0 and always gets compared with same
Yes Price is a column in the datatable. Would I create a variable using what you wrote? Or would I write that down in the condition VB expression for the if statement?
When i input that into the vb expression, the flow still runs, but again I get no excel file created for either cheap or expensive products.
It runs, but there is still no excel output. It should be checking in each row for the price of the item that it is below 300. if it is, it should write that row to the excel file. If it is above 300, it should write to a different excel file. Nothing is being executed though. After the data scraping, it says the execution is finished so I am not sure why it is not writing anything to the excel.
You have to change some logic in your code first of all, take two assign activity above for each row in datatable activity, create two new datatable variable dt_ProductsUnderprice and dt_ProductsOverprice, assign them the structure of extracted table using Clone Method.
Put Add Data Row Activity in both section Then and Else, as mentioned in below image.
At the end outside foreach row activity take two write range activities, and pass those two data table variables in them.
Note. Select Add Header Property.
You will get a excel file with two different sheets.