Here is my function:
to handle SaveReport reportFile, resultList
Log resultList
put the number of items in the first item of resultList into count
subtract 1 from count
put () into newLine
if file reportFile does not exist then
create file reportFile
open file reportFile for writing
else
open file reportFile for appending
end if
repeat count times
put repeatIndex() into loopcount
repeat for each valueList in resultList
insert item 1 of valueList after newLine
put "," after newLine
put item loopcount + 1of valueList after newLine
combine newLine
put CarriageReturn after newLine
write newLine to file reportFile
put () into newLine
end repeat
write CarriageReturn to file reportFile
end repeat
close file reportFile
end SaveReport
Data Set 1:
put “testfile.csv” into myFile
put ((“Build”, “Trunk 21321”), (“Login Test”, 21.54), (“Event Test”, 52.3)) into myList
Result Set 1:
Build,Trunk 21321
Login Test,21.54
Event Test,52.3
Data Set 2:
put (“Build”, “Thar 23545”) into the first item of myList
insert (“D&D Hostile”, 23.56) nested after myList
insert (“Report Button”, 17.35) nested into myList
Result Set 2:
(Build,Thar 23545)
D&D Hostile,23.56
Report Button,17.35
If I log out either data set before I run the SaveReport function, the results look the same, but the function is somehow treating them differently. Can someone please explain.