FileOutput without break on Lists



  • I need to do fileoutput without generating a new set of all data on each list lines.

    using output normally as LIST[*] just generate new set of all data output for each list line.
    I want it to just paste in file whole list lines without generating new set for every line in list.
    @Ruri


  • Admin

    You should use the utility function for lists -> Join (which will join all the elements of a list into a single variable) and then use the utility file write (not writelines)



  • Even possible to write each single element of the list in new line?
    I dont think LIST[some index] like this will work because it just stores all like 20 elements in one index when there is recursive parse.
    So, is it possible to write each element of list in new line? or maybe how to separate them. @Ruri


  • Admin

    Can you please provide an example? I don't understand anything from your explanation


  • Admin

    If you just want to write to file, just use Utility File WriteLines



  • I mean writing single element of list in new line in file.
    Like for eg.
    we have a List
    [[1,2,3,4,5,6],[7,8,9,10,11],[12,13,14,15]]
    I want to write each element in file in new line and file should look like
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    ...


  • Admin

    SET VAR "LIST" "[[1,2,3,4,5,6],[7,8,9,10,11],[12,13,14,15]]"
    FUNCTION Replace "[" "" "<LIST>" -> VAR "LIST" 
    FUNCTION Replace "]" "" "<LIST>" -> VAR "LIST" 
    UTILITY Variable "LIST" Split "," -> VAR "NEWLIST" 
    UTILITY File "test.txt" WriteLines "<NEWLIST[*]>" 
    

    Just tested it, and it works



  • Works as I wanted.
    Thanks ruri for help.
    OB is just awesome


Log in to reply