IT Process Automation

Expand all | Collapse all

Write out the contents of a dataset array variable to file.

Jump to Best Answer
  • 1.  Write out the contents of a dataset array variable to file.

    Posted 01-02-2014 11:28 AM

    I have a dataset configured with variables that are a single dimension array.
    I want to write the whole contents of the array variables to a file.

    I have enabled "File Contents As Array" within the "Write File" operator.
    I can then write out individual indexed values as follows-

    Datasets["datasetname"].varname[0]
    Datasets["datasetname"].varname[1]

    There are 100s of indexed values in my variable, so don't want to do this for all.
    I've tried the following, but this results in error
        Datasets["datasetname"].varname

    also
        Datasets["datasetname"].varname.toString
    results in-
        org.mozilla.javascript.IdFunctionObject@47df3659

    also
        Arrays.toString(Datasets["datasetname"].varname)
    results in the same line printed to the text file

     

    UPDATE:

    If I don't enable "File Contents As Array" and enter the "File Contents" as -
        Datasets["datasetname"].varname
    , then the array is output to the file.

    This still doesn't enable me to print more than 1 variable. I tried entering the "File Contents" as -
        Datasets["datasetname"].varname,Datasets["datasetname"].varname2

    , but this only outputs the second variable.

    Is the expected usage to use more than 1 "Write File" operator?

     



  • 2.  RE: [PAM - Support Articles and Tech Tips] Write out the contents of a data
    Best Answer

    Posted 01-02-2014 03:44 PM
    Use the javascript join() function to create a string from an array.

    Datasets["datasetname"].varname.join("\n") as an example.

    Thanks,
    Tom

    From: CA Process Automation Global User CommunityMessage Boards [mailto:CommunityAdmin@communities-mail.ca.com]
    Sent: Thursday, January 02, 2014 11:28 AM
    To: mb_message.97479212.106949711@myca-email.ca.com
    Subject: [PAM - Support Articles and Tech Tips] Write out the contents of a dataset array variable to file.


    I have a dataset configured with a variable that is a single dimension array.
    I want to write the whole contents of the array variable to a file.

    I have enabled "File Contents As Array" within the "Write File" operator.
    I can then write out individual indexed values as follows-

    Datasets["datasetname"].varname[0]
    Datasets["datasetname"].varname[1]

    There are 100s of indexed values in my variable, so don't want to do this for all.
    I've tried the following, but this results in error
    Datasets["datasetname"].varname

    also
    Datasets["datasetname"].varname.toString
    results in-
    org.mozilla.javascript.IdFunctionObject@47df3659<mailto:org.mozilla.javascript.IdFunctionObject@47df3659>

    also
    Arrays.toString(Datasets["INTaaS_config"].znac7601)
    results in the same line printed to the text file

    How can i iterate through the array within "Write File"?
    Posted by:gold12345
    --
    CA Communities Message Boards
    106952251
    mb_message.97479212.106949711@myca-email.ca.com<mailto:mb_message.97479212.106949711@myca-email.ca.com>
    https://communities.ca.com


  • 3.  RE: [PAM - Support Articles and Tech Tips] Write out the contents of a data

    Posted 01-03-2014 04:32 AM

    Exactly what I was looking for, and still uses "File Contents As Array".

    thanks