Convert Null values to Zero

Comments

2 comments

  • Avatar
    Stony Smith

    This will work:

    c=long("0"+MyField.trim())
    override emit c as MyField

    0
    Comment actions Permalink
  • Avatar
    Adrian Williams

    In recent versions of Dataverse, the use of the proprietary Dataverse Script has been superseded by the Python language.

    While the Dataverse Script [and the original Transform (Superseded) node] is still available for existing data flows, Lavastorm recommends the use of Python in the Transform node for current projects.

    With this in mind, here is a data flow that shows how multiple string type fields can be converted to int type fields or float (double) type fields.

    To configure the conversions you need to add the names of the integer type field and double/float type fields to the appropriate list in the 'ConfigureFields' script.

    The node uses the lists of fields to remove the existing metadata for the specified fields and then re-creates the metadata for the fields with the appropriate data type.

    The script in the 'ProcessRecords' property performs the value conversions. In addition to converting NULL values to zero it also converts empty strings and strings containing only whitespace characters to zero.

     

    Note: you will need a minimum of Dataverse 3.1.6 to import the .lna file.

     

    Attached files

    Convert_Null_values_to_Zero - 29 Nov 2017.lna

    0
    Comment actions Permalink

Please sign in to leave a comment.



Powered by Zendesk