We recommend switching to the latest versions of Edge, Firefox, Chrome or Safari. Using Internet Explorer will result in a loss of website functionality.

Python Substitues for Brainscript (inputFields, field)


1 comment

  • Avatar
    Adrian Williams

    The closest equivalents in a Transform node would be to use the fields.todict() function in the ConfigureFields to create a dictionary representation of the input fields and then use the keys() function on dictionary object to get the list of input field names.



    Within the ProcessRecords script you can use fields['Some_Field'] to access the value of the field named "Some_Field" in the current record. If you are outputting the values for multiple input fields with different data types then you will need to cast the field values to an appropriate common data type e.g. a string.



    See the 'Python scripting' > 'API and script bindings' topic in the integrated Help documentation or the corresponding online documentation for the latest version of Data3Sixty Analyze here

    To output the cells for each input record on a different output record you will need to explicitly write the output records using say the node.write() function as described in the 'API and script bindings' topic and see the example in the default script of the Transform node.

    Also see the attached data flow that provides an example of how the cells in an input data set can be 'pivoted' into a set of key: value pairs. The example extends this to also include: a field indicating which input record the key: value pairs are associated with; a field indicating the data type of the input field; a field indicating whether the original value was Null (to allow you to disambiguate a Null value in a string from the string "Null").

    Requires Data3Sixty 3.4.x or above.


    Attached files

    Pivot Data Cells_3.4.2--share - 29 Jul 2019.lna


    Comment actions Permalink

Please sign in to leave a comment.