Skip to main content
Known Participant
Oct 15, 2021 1:01 AM UTC
Question

CSV string

I have a csv string which i am getting it from blueprism through integration. i need to perform some calculation based on this value, i need to iterate this string. but i am unable to iterate its taking as only one string, i want to iterate for each line in this string.

"ABC,ABC,2,06:00:00,18:00:00,0.5,3
XYZ,XYZ,3,06:00:00,18:00:00,0.5,3"
please any suggestions on this.

    12 replies

    Participating Frequently
    Oct 15, 2021 2:20 AM UTC

    You can use split() function which splits text into a list of text elements, delimited by the text specified in the separator. In your case delimiter is ",". 

    https://docs.appian.com/suite/help/21.3/fnc_text_split.html

    split("ABC,ABC,2,06:00:00,18:00:00,0.5,3
    XYZ,XYZ,3,06:00:00,18:00:00,0.5,3", ",")

    This will return individual elements from your original string that are separated by comma. You can then use a!foreach() to iterate over each element.

    Known Participant
    Oct 15, 2021 7:17 AM UTC

    i have many lines, in each line it is seperated by comma's

    stefanhelzle0001
    Brainy
    Oct 15, 2021 10:44 AM UTC

    First, use split to get the lines using "char(10)" as the delimiter. Then, in a foreach, use the comma delimiter to get the values for each line.