Integration

Get Involved. Join the Conversation.

Topic

    Cesar Tepetla Corte
    Divide a line every time you find "," to insert...
    Topic posted April 26, 2019 by Cesar Tepetla CorteBronze Medal: 1,250+ Points, tagged Adapters, Cloud, Connection, Database, Events, Mapping, Orchestration, Process, Web Services, xml 
    80 Views, 5 Comments
    Title:
    Divide a line every time you find "," to insert into a database.
    Summary:
    Divide a line every time you find "," to insert into a database.
    Content:

    I am working on an integration which receives a line similar to this one: 126,12,2007,1100 and I have to divide it to insert in a table with four fields, I have tried with the stage file object to write and read to separate the lines of the field without success.

    Any comment is grateful....

    Comment

     

    • Stephen Bryant
      One thought; did you try using substring() in the mapper?
      
      
      
    • Hemanth Lakkaraju

      This might help in your case!

      • Cesar Tepetla Corte

        Hi Hemanth I have reviewed that post but I can not understand how to adapt that line to my case, the line I intend to divide comes in one variable.

        for example:

        var_line: "value1, value2, value3, value4"

        Now I have added a for-each and the function create-nodeset-from-delimited-string and I need to assign each cut (,) to a variable so that in the mapping with the database I can assign each value divided in the function create- nodeset-from-delimited-string will have an example of doing this in OIC.

        oh seeing the example that you placed in the other post of form I can create an intermediary schema?

        • Hemanth Lakkaraju

          Yes, You can create an intermediate schema with a simple repeating element use stage write and map the data with the above function. Use same schema to read from stage and you will get a repeating element with split values. So you can use this in individual mapping with xpath expression like $stageRead/repeatingElementList/repeatElement[1] and so on.

          • Cesar Tepetla Corte

            Hi Hemanth,
            I have some doubts:

            1. In the stage write, should you place an XML schema of the example content structure? or just in the mapping?

            2. the repeating element should I place it on stage write or stage read?

            3. this repeatElement [1] should I put it in stage read as an example content structure? or as a mapping structure? How can I do that? editing the schema manually?