Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!

Using V_String as Field type for Output RecordInfo in Custom Tool using Python SDK

8 - Asteroid

I am creating a custom download tool using the Python SDK. The output will include lengthy 30k+ lines of JSON string response. The documentation for the class Field denotes "string" to be used for all possible string data types in Alteryx. But add_field or add_field_from_xml method for RecordInfo is also asking for a fixed size, in absence of which, the following error is thrown:


Code used = Sdk.RecordInfo(1)

# using Add Field From XML"<Field name=\"DownloadHeders\" type=\"V_String\" >")"<Field name=\"DownloadData\" type=\"V_String\" >")

# Using Add Field"DownloadHeaders", Sdk.FieldType.string)"DownloadData", Sdk.FieldType.string)



Error Thrown









In the scenario where I do specify the size and it exceeds the limit, following warning and error is thrown


So my question is how do I use v_string i n the python code without having to specify a fixed size for the field?

11 - Bolide

Hi @fardeen9983 , use Sdk.FieldType.v_string to add a V_String field.  You will need to specify the max number of characters that field can hold, which I tend to default to the max possible of 2147483647.  The actual size of the field will vary with the size of the data being stored.  The function call would look something like this:"DownloadData", Sdk.FieldType.v_string, size=2147483647)