ADF - flatten activity

Shraddha Choudhary 0 Reputation points
2025-01-23T10:41:18.9933333+00:00

Hi team,

I am facing the issue while reading the xml using ADF copy activity.

string value “6E12” is getting converted into 6000000000000 while reading the XML file with flatten hierarchy.

Please help in resolving the issue.

thanks,

shraddha

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,194 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Amira Bedhiafi 28,376 Reputation points
    2025-01-23T12:01:54.1933333+00:00

    You need to check the schema definition in the Copy Data activity or the Data Flow that reads the XML file and try to set the data type of that field to string to prevent it from being interpreted as a numeric value.

    Or you can add a derived column or use a transformation in your Data Flow to explicitly convert the value back to its string representation using an expression like:

    toString(<column_name>)
    
    

  2. Ganesh Gurram 3,690 Reputation points Microsoft Vendor
    2025-01-24T13:35:16.7866667+00:00

    Hi @Shraddha Choudhary

    Greetings & Welcome to the Microsoft Q&A forum! Thank you for sharing your query.

    Thank you for the clarification.

    Since you're not using Data Flow and the Copy Activity is still interpreting the string value "6E12" as a numeric value despite the mapping being set to String, here are a few alternative approaches you can consider:

    Double-check the source dataset configuration in ADF. Ensure that the dataset is set up correctly to read the XML file and that there are no conflicting settings that might affect data type interpretation.

    Even though the value is surrounded by quotes, ADF might still interpret it as a numeric value due to its format. Try escaping the quotes in the XML (e.g., \"6E12\") to see if it forces ADF to treat it as a string.

    If you're using XML as your source, there could be an issue with how the XML is parsed. One way to test is to try reading from a flat file source (if possible) and see if the same issue occurs. This could help isolate whether it's an XML parsing issue specifically or an issue with the Copy Activity itself.

    For more details refer: Schema and data type mapping in copy activity

    Data type mapping in a copy activity

    I hope this information helps.

    Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.