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.  Help! Nesting Functional Maps

    Posted 11/26/04 10:52 AM

    Originally posted by: SystemAdmin


    Hello, I am new to TX and have a problem getting my functional maps to work the way I am wanting to. The scenario is this: I'm getting XML input and coverting to flat file output. Based on data in the XML I may produce the output in a different way for some transactions than for others. But some data elements are common to both. Therefore, in order to reduce the if/then/else complexity in the formula fields, I am trying to set up a functional map to handle the common fields and then pass that output off to the appropriate functional map for the remaining fields. If this were some other programming language, I could do it w/o any problem, but I can't seem to get the nested function to work.

    So what I am trying to do is use the output of one functional map as an input parameter for another functional map. Here is the rule formula:

    In the executable Map:
    =f_MAP1(XML Transaction:In1,f_MAP2(XML Transaction:In1))

    No matter what I try, I cannot get any formulas to process in f_MAP1. The rule trace only shows formulas in the f_MAP2 as processing. It is like TX, when it sees that f_MAP2 completes successfully, it passes back the output of it to the executable map.

    To me this would be analogous to nesting method calls in Java:
    result = item2.method1( "TEXT", item2.method2(123) )

    Am I doing something really stupid and can't see the forest for the trees? Or is this something that TX just can't do?

    Thanks for your help.

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


  • 2.  Re: Help! Nesting Functional Maps

    Posted 11/30/04 05:41 AM

    Originally posted by: SystemAdmin


    One method used to do what you would like to do is to use multiple output cards. OutputCard1 runs the the functional map, f_MAP2(XML Transaction:In1), and OutputCard2 runs the functional map, f_MAP1(XML Transaction:In1, SomeObject:OutputCard1. Another is to use a single output card and run f_MAP2 before running f_MAP1.

    Jim Divoky, EC Solutions, Inc., 330-606-6826
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: Help! Nesting Functional Maps

    Posted 11/30/04 11:38 AM

    Originally posted by: SystemAdmin


    John -- functional maps do not create intermediate results; they always write directly to the output. Therefore, you can not use functional map calls as arguments to functions or other functional maps (notable exceptions: Functional maps may be arguments to the EITHER or IF functions).

    This has been a limitation in the product since V1.0.

    The correct resolution here depends upon what F_Map2 is doing. If it's simply performing a calculation, you probably want to call F_Map2 in a rule that resides within F_Map1.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 4.  Re: Help! Nesting Functional Maps

    Posted 11/30/04 05:42 PM

    Originally posted by: SystemAdmin


    Thanks for the help. I'm just so used to being able to do this sort of thing in Java and other languages and knew either TX wasn't able to do it or I was doing something wrong. I figured TX probably couldn't do it and that I would have to come up with another solution. Thanks for the multi-card solution Jim.

    rmcfate, I also would like to know more about how you test the output of a functional map in an if statement. Does the output have to be a single text field or something to that effect?

    One other feature I really wish was there is a way to do a case statement on a value. Say if I call a functional map to return a value and then test that value against multiple conditions. i.e.

    code:1:754ca92e98=Case(f_map(SomeObject),
    ="1","ThisValue",
    ="2","ThatValue",
    ="3","NoValue",
    ...
    nCondition,nResult)[/code:1:754ca92e98]
    or maybe...
    code:1:754ca92e98=IfCase(f_map(SomeObject),
    {="1",="2",="3",...,nCondition},
    {"ThisValue","ThatValue","NoValue",...,nResult)[/code:1:754ca92e98]
    I know the syntax is crappy, but it would be nice so you didn't have to nest if statements and re-evaluate f_map each time.

    Now I bet I have gone and shown myself for the noob that I am on TX.
    ___________________
    "Better to keep one's mouth shut and be thought a fool, than to open it and remove all doubt." -Mark Twain
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 5.  Re: Help! Nesting Functional Maps

    Posted 12/03/04 09:04 AM

    Originally posted by: SystemAdmin


    John,

    Take a look at the MEMBER function. It may suit your needs. It works like a case statement.

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


  • 6.  Re: Help! Nesting Functional Maps

    Posted 12/07/04 04:10 AM

    Originally posted by: SystemAdmin


    Yeah, I know what you are saying about the MEMBER function. But it only returns true when a value is in a list of values. You don't have logic in it to tell you when value is equal to a certain value. Anyway, I know there isn't a function to do what I want so I'll stop bellyaching about it.

    Thanks,
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 7.  Re: Help! Nesting Functional Maps

    Posted 12/09/04 03:43 AM

    Originally posted by: SystemAdmin


    Functional maps can be arguments to the EITHER function only in that EITHER can distinguish whether the functional map was actually called or not.

    Functional maps aren't called when any of the parameters being passed to the functional map resolve to NONE. If you put the functional map invocation in an EITHER function, then EITHER will recognize whether the functional map was called, and execute the second parm of EITHER when the first parm doesn't actually result in the execution of the functional map referenced in the first parm of EITHER.

    The way IF handles functional map invocations is similar: you can't test the output of the functional map; you can only test whether the functional map was really called or not.

    The only way to test the output of a functional map invocation is by referencing the earlier output (in other words, call the functional map in one rule, and reference the output of that rule in a later rule).
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 8.  Re: Help! Nesting Functional Maps

    Posted 12/09/04 03:44 AM

    Originally posted by: SystemAdmin


    Functional maps can be arguments to the EITHER function only in that EITHER can distinguish whether the functional map was actually called or not.

    Functional maps aren't called when any of the parameters being passed to the functional map resolve to NONE. If you put the functional map invocation in an EITHER function, then EITHER will recognize whether the functional map was called, and execute the second parm of EITHER when the first parm doesn't actually result in the execution of the functional map referenced in the first parm of EITHER.

    The way IF handles functional map invocations is similar: you can't test the output of the functional map; you can only test whether the functional map was really called or not.

    The only way to test the output of a functional map invocation is by referencing the earlier output (in other words, call the functional map in one rule, and reference the output of that rule in a later rule).
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender