LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  CSV numbers imported as scientific notation

    Employee
    Posted 11-24-2016 12:22

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: islandz

    I have a CSV file that has a bunch of phone numbers (and other data). When I open the file in a text editor, the numbers look fine. However, when I import via the CSV import node, the numbers show as scientific notation. The issue is that when I export to a text file, the numbers remain as scientific notation, instead of a proper phone number.

    Thank you, in advance, for your help.


  • 2.  RE: CSV numbers imported as scientific notation

    Employee
    Posted 11-25-2016 05:49

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    Hi,

    When data is imported using the CSV File all the fields have a data type of 'string' (see the attached example data flow and test data .csv file). If you view the data at the output of the CSV File node you can see the assigned data type in the Data Viewer under the field names.

    You do not state how the phone numbers are being converted to a Double data type but I assume you may be using the Data Converter node. This node will attempt to identify the appropriate data type for each field - though obviously it does not know the context of the data, just the format, which can lead to the scenario you raised.

    If you want to automatically convert most fields but not specified fields you could use the approach shown in the data flow to split the imported data into two streams, convert one stream and then combine the converted data with the data in the second stream.

    The Filter node that splits the imported data uses a 'Rec_Id' field to ensure the records are merged correctly. If you want to remove this field from the merged data set you could add the following line in the Script property shown in the 'Combine Data Stream' Join Node's Output tab on any line after line 3:

    exclude referencedFields(1,{{^RightInputKey^}})
    Selective_Data_Conversion.zip

    Regards,
    Adrian

    NB: The path of the CSV File node needs to be changed to align with the location where the test data has been saved to.


  • 3.  RE: CSV numbers imported as scientific notation

    Employee
    Posted 11-25-2016 07:49

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: islandz

    Originally posted by: awilliams1024
    					

    Hi,
    You do not state how the phone numbers are being converted to a Double data type but I assume you may be using the Data Converter node. This node will attempt to identify the appropriate data type for each field - though obviously it does not know the context of the data, just the format, which can lead to the scenario you raised.
    Hi Adrian,

    There is no Data Conversion in my flow. Basically, as the output of the import node, is the point at which the phone numbers show as scientific notation. If I look at the field types, they all show as string, but it puzzles me why it shows like this and not just as text, with the full data.

    Ahmad


  • 4.  RE: CSV numbers imported as scientific notation

    Employee
    Posted 11-25-2016 08:55

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    Hi Ahmad,

    would you be able to provide a small copy of the (anonymised) data as a CSV file?

    Regards,
    Adrian