IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  insert a new record in a record (s)

    Posted 05/31/06 05:56 AM

    Originally posted by: SystemAdmin


    hiii

    Which way would be the best to insert a new record in a record(s) structure? What I would like to do is to merge 2 files. Every time I receive a new file of prices, I d like to get prices from this new file <PR_NEW> file and to add them to a global file (<PR_LAST> file ) . here are An example of the files:

    the files structure would be:

    File (1:1)
    Instrument_record (s)
    name (1:1)
    prices_record (s)

    a new file of prices:

    <PR_NEW>
    <Instrument>
    <Name>SOLVAY</Name>
    <Price>18</Price>
    <Price>20</Price>
    </Instrument>
    <Instrument>
    <Name>COCA COLA</Name>
    <Price>10.5</Price>
    <Price>12.5</Price>
    <Price>13.5</Price>
    <Price>14</Price>
    <Price>14.1</Price>
    </Instrument>
    </PR_NEW>

    The global file:

    <PR_LAST>
    <Instrument>
    <Name>SOLVAY</Name>
    <Price>15</Price>
    <Price>16</Price>
    </Instrument>
    <Instrument>
    <Name>IBM</Name>
    <Price>10.5</Price>
    <Price>12.5</Price>
    <Price>13.5</Price>
    <Price>14</Price>
    <Price>15t</Price>
    </Instrument>
    </PR_LAST>
    The result should be (PR_LAST file after modification):

    <PR_LAST>
    <Instrument>
    <Name>SOLVAY</Name>
    <Price>15</Price>
    <Price>16</Price>
    b:2f270685cbcolor=red:2f270685cb<Price>18</Price>
    <Price>20</Price>[/color:2f270685cb][/b:2f270685cb]
    </Instrument>
    <Instrument>
    <Name>IBM</Name>
    <Price>10.5</Price>
    <Price>12.5</Price>
    <Price>13.5</Price>
    <Price>14</Price>
    <Price>15t</Price>
    </Instrument>
    b:2f270685cbcolor=red:2f270685cb<Instrument>
    <Name>COCA COLA</Name>
    <Price>10.5</Price>
    <Price>12.5</Price>
    <Price>13.5</Price>
    <Price>14</Price>
    <Price>14.1</Price>
    </Instrument>[/color:2f270685cb][/b:2f270685cb]
    </PR_LAST>
    As SOLVAY instrument already exists in global file, I would only a new prices (in prices_record (s) )

    Coca Cola Does not exist yet. So I would add a new instrument_record in instrument_record (s)

    I Hope it clear :o)

    thanks for help.

    Stephane
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 2.  Re: insert a new record in a record (s)

    Posted 05/31/06 06:13 AM

    Originally posted by: SystemAdmin


    Might be much easier to use a database. If the data is new, it would be inserted, if changed, it would update.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 3.  Re: insert a new record in a record (s)

    Posted 06/02/06 02:54 AM

    Originally posted by: SystemAdmin


    Hello,

    what you have to do is basically set union based on a) the instruments already known (global file) and b) the new instruments given. Having that set, you can build a functional map that iterates over it and either looks up the values from the global file and/or the new file. Adding the instrument's prices is rather simple as it is simply an addition. The difficult part ist to build the list (series) of all instruments, i.e. calculate the set union. One way to get it is to
    • extrakt all instrument names from both the global and the new file (using EXTRACT and UNIQUE), resulting in two independent series with probably overlapping instruments
    • create a functional map that runs exactly as many times as the sum of those both lists gives (just pass as first parameters a dummy object that is CLONEd as many times). The map will likely also need the original series as parameters (but be sure to pass the series element, not the elements of the series as this would otherwise cause the cartesian product to be calculated) E.g.:
    code:1:b939e3ff7b=f_filter(CLONE("DUMMY", COUNT(Instrument_record:Global File) + COUNT(Instrument_record:New File)), INDEX($), Global File, New File)[/code:1:b939e3ff7b]
    • make this functional map "filter" the instruments by either returning the instrument (if it's unknown so far) or NONE (it it has been seen already) so that you end up with the union of the instruments. Note that this is basically the hardest part as it will require LOOKUPs in the original series
    • take the union of instruments as iteration source for the final step, adding the prices to each instrument

    Feel free to ask if this draft is unclear

    Michael
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: insert a new record in a record (s)

    Posted 07/10/12 04:51 AM

    Originally posted by: SystemAdmin


    Hi Micheal,

    I was going through this post and I have a similar issue. I was not clear with your post, and hence I am writing this to you. Let me brief you my problem.
    I have a situation in which I have to generate one xml, and embed that xml in another xml. I am trying to simplify my problem with an example -

    Consider I have 2 xsd's - employee.xsd and salary.xsd.
    salary.xsd generates an xml in which I have the split of my salary structure. So, a very basic salary.xml would look like -
    <salary>
    <basic>1000</basic>
    <tax>50</tax>
    <HRA>123</HRA>
    </salary>

    employee.xsd generates an xml in which we have all the details of an employee like name, age, DOB and a also tag called as salarystructure. I want to embed the salary xml (shown above) inside this salarystructure tag. So, a very basic employee.xml would look like:

    <employee>
    <name>Anannya</name>
    <age>26</age>
    <DOB>3rd Feb</DOB>
    <salarystructure>
    <salary>
    <basic>1000</basic>
    <tax>50</tax>
    <HRA>123</HRA>
    </salary>
    </salarystructure>
    </employee>

    Can you please let me know how to do this in WTX? I tried using 2 output cards with the "Onsuccess -> append" option applied for the 2nd one, but the salary xml gets appended to the employee xml at the very end i.e. at after the </employee> tag. This is not what I want. I want to EMBED it in between. Any inputs?
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender