Options

"Enrich data webservice"

RadimVRadimV Member Posts: 1 Contributor I
edited June 2019 in Help
Hi,
I am trying to use the webservice component, everything works, but I don't know to manage a his case :
I read a text file and for each record / line I generate web request, the web service response retrieves to me a xml data, where one or more record can appear. It is similar to an invoice, I post invoice number and get list of items in the invoice.
Till now what I do and what I get :
input txt file :
date; some text; invoice number;
date; some text; invoice number;

i get the result:
date; some text; invoice number;item 1; but this invoice has 2 items
date; some text; invoice number;item 1; but this invoice has 4 items

i would like to get something like that :
invoice number 1;item 1;price
invoice number 1;item 2;price
invoice number 2;item 1;price
invoice number 2;item 2;price
invoice number 2;item 3;price
invoice number 2;item 4;price


Any idea how to solve it ?
thanks in advance. Radim

Answers

  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi Radim,

    you could use Generate Id on your input data to create a unique identification for each record, then call the webservice, but get the complete XML, and process it further with Process Documents + Split Documents + Extract Information, splitting each xml/invoice into several documents, but always keeping the unique ID that you created in the first step. In the end, you will have:
    - the input example set with the unique id
    - a dataset with a line containing the unique id + item name and price

    Then you can use the Join operator to combine both sets by id.

    Best regards,
    Marius
Sign In or Register to comment.