I am trying to automate a repetitive task that involves taking the project title, hours for role A, and hours for role B from multiple project reports and exporting that to CSV.
The problem I am encountering is that for larger projects, some have hours that are more than 1000, e.g. 1,234.56, and because of the comma, the test case fails when it tries to append it to csv with a " [error] The amount of data miss match the amount of column in data file" error." message.
Is there a way to remove or change the comma to a different character before appending it to CSV? Would any of these options be doable through recorder as I am not dev savvy? When I looked into exporting the code, it seems like they don’t accept the appendToCSV command either, which makes sense, so I have no idea what to do.
I feel foolish already considering how long it took me to figure out that the problem was the comma, and at this point I’ve probably spent more time trying to figure this out than it would have taken me to just check the projects manually for the next few months, but I’m in too deep to give up.
Thank you both for the information! Looks like recorder doesn’t do what I would need in this case, so I’ll have to try with Studio. So far I have not been able to figure out how to export this data to csv in Studio, but at least it’s a new problem to sort out.
Very fragile indeed! I tried having it append the data in double quotes, and it works for numbers without a comma, but it still throws the exact same error when there is a comma in between those quotes.
I’ve encountered this issue with the (lack of) handling of commas in strings (with CSV files), so I usually use the following command (as suggested by others, but this one is suitable for Katalon Recorder):
storeEval | Result = “1,000,000.00”; Result.replaceAll(“,”,“”); | NewResult
You can then store this new value with appendToCSV. I agree that it would be good if Katalon Recorder was more robust in this sense (as then you wouldn’t need to ‘process’ strings in this way).