ArrayToCSV

Converts a simple Array into a textual comma separated string.

python · Common Scripts

Source

from traceback import format_exc

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401


def arr_to_csv_command(array: list[str] | str) -> str:
    csv = ",".join(array)
    return csv


def main():  # pragma: no cover
    args = demisto.args()
    array = argToList(args.get("value"))
    try:
        return_results(arr_to_csv_command(array=array))
    except Exception as e:
        demisto.error(format_exc())
        return_error(f"ArrToCSV command failed. Error: {e}")


if __name__ in ("__main__", "__builtin__", "builtins"):
    main()

README

Converts a simple Array into a textual comma separated string

Script Data


Name Description
Script Type python3
Tags transformer, general
Cortex XSOAR Version 6.0.0

Inputs


Argument Name Description
value An array of strings input

Outputs


There are no outputs for this script.

Script Examples

Example command

!ArrayToCSV value=`["example","example"]`

Context Example

{}

Human Readable Output

example,example

Example command

!ArrayToCSV value="example,example,example"

Context Example

{}

Human Readable Output

example,example,example