Hi All,
My requirement is getting data from db and creating a csv file with that. I followed the below steps.
I got the data from db with my required columns say col1,col2 and col3. When i am trying to append everything to a string, i am not getting expected resultSet. I first initialized errorData string variable with empty string.
since you are looping over getTracedataOutput/results, you should remove the index of [$iteration], directly use:
%getTracedataOutput/results/BID% for inString2.
You can append “\r\n” after “%getTracedataOutput/results/TID%” like “%getTracedataOutput/results/TID%\r\n”, then you will get the errorData like:
bid1,tid1
bid2,tid2
bid3,tid3
Save the errorData string into a file named whatever.csv, you don’t need to do something to maintain the columns, Excel will do it.
Hi,
I tried a sample service my errorData looks like bid1,tid1,error1 bid2,tid2,error2 bid3,tid3,error3
You can tokenize the string based on space character and then remove the comma if you need (customize the code).
valueList will look like
bid1,tid1,error1
bid2,tid2,error2
bid3,tid3,error3
Pass this as your second input to string concat.
%Mahesh.SAG:getTracedataOutput/getTracedataOutput/results/BID%,%Mahesh.SAG:getTracedataOutput/getTracedataOutput/results/TID%,%Mahesh.SAG:getTracedataOutput/getTracedataOutput/results/ERROR%[one space at last]
Sorry, it’s my fault, it won’t work in that way. You can right click on the input control, and click “Use larger editor” as attached screen-shot, in this editor you can type a carriage return.
Hi,
When i am writing everything to a string list and finally when i am passing it to a fileWriter service,it is just taking very 1st line of String list and writing to a file (is it just because fileWriter takes string as an input ).
When i tried differently like keeping everything in to a single variable say –
final String : bif1,tif1"\r\n"bif2,tif2"\r\n"bif3,tif3"\r\n", when i am writing this to a file it is writing file content too with the same data instead of appending new line in place of “\r\n”.
You can right click on the input control, and click “Use larger editor” as attached screen-shot, and HIT enter the cursor and close the setValue and save it.\