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.  Numeric Validation on field with Text Subclass

    Posted 05/08/14 12:46 PM

    Originally posted by: mseedig


    Ok, I have been trying to work through this and the answer is probably staring me in the face but I just can't see it. I am using WTX v8.4 (specifically 8.4.0.2, build 12), and I have a data element that has an item subclass of Text in the type tree, but my users require me to validate that the data we received was all numeric. I've been trying various things and combination of things (TEXTTONUMBER, ISNUMBER, etc), but so far everything I do causes an error due to the mismatch when I try to build (and I get why). Any ideas what I might try, other than changing the subclass in the type tree?

     


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


  • 2.  Re: Numeric Validation on field with Text Subclass

    Posted 05/08/14 01:28 PM

    Originally posted by: Arun Ramamurthy


    Are you trying to validate this within a map rule? A rule something as below should work in a map .

    out=If(ISNUMBER(fld:inp),"Yes","No")

    Here the ISNUMBER is being used to check if the value in fld:inp has all numeric characters. The calling field - "out",  in this case was a text item and the input  "fld:inp" is also a text item.

     


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


  • 3.  Re: Numeric Validation on field with Text Subclass

    Posted 05/08/14 04:38 PM

    Originally posted by: mseedig


    Yes, I am trying to validate this within a map rule. What I have is the following (I've changed the labels to generic names for an attempt at clarity):

     

    =IF(ABSENT(ResultsFromPreviousRule)      /* If the previous rule in this loop did not write an error */

    & PRESENT(MappedValue),     /* and if a mapped value is present in the data */

    IF(NOT(ISNUMBER(MappedValue)) , "ErrorCode"))     /* if the mapped value is not a number, output the specified error code */

     

     

    1. I ran an input that had a value of ABCDEFGHI mapped to the element.
    2. The previous rule in the loop did not write an error.
    3. The output showed that a mapped value of ABCDEFGHI was present in the data.
    4. The output did not contain the specified error code.

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


  • 4.  Re: Numeric Validation on field with Text Subclass

    Posted 05/08/14 04:55 PM

    Originally posted by: Arun Ramamurthy


    The below modified rule builds successfully and works on 8404.

    =IF(ABSENT(fld[1]:op)  & PRESENT(fld:inp),   
    IF(NOT(ISNUMBER(fld:inp)) , "ErrorCode"))

    I get a result of "ErrorCode" when the fld:inp = "text"  and fld[1]:op which is a prior rule has None in it.

    Not sure if this is an issue on 8402. What specific build error are you encountering?

     


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


  • 5.  Re: Numeric Validation on field with Text Subclass

    Posted 05/08/14 05:07 PM

    Originally posted by: mseedig


    My apologies, in my haste I ended up being unclear. The rule I referenced above:

     

    =IF(ABSENT(ResultsFromPreviousRule) & PRESENT(MappedValue), IF(NOT(ISNUMBER(MappedValue)) , "ErrorCode"))

     

    builds without an error, but I do not get the expected error code in the output when I have a non-numeric value in the input. That is the condition I was trying to fix. I tried the below modification, and get an M113 Error when building, Argument #1 for function ISNUMBER is invalid.

     

    =IF(ABSENT(ResultsFromPreviousRule) & PRESENT(MappedValue), IF(NOT(ISNUMBER(TEXTTONUMBER(MappedValue))) , "ErrorCode"))


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


  • 6.  Re: Numeric Validation on field with Text Subclass

    Posted 05/09/14 09:12 AM

    Originally posted by: Arun Ramamurthy


    This rule will get a build error because the ISNUMBER function expects a text argument where as the TEXTTONUMBER yields a NUMBER item .

    The ISNUMBER should work by itself . Not sure why you are not getting the expected result. Was able to access a 8402 and test with it and the rule works and gives the result of "ErrorCode" in that version as well. Are you hard coding the value "ErrorCode" or are you using a variable item in there to get different error code values? I would try hard coding as a first step and see if that works and go from there.


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


  • 7.  Re: Numeric Validation on field with Text Subclass

    Posted 05/09/14 10:03 AM

    Originally posted by: mseedig


    It is a hard coded value. The actual rule is:

     

    =IF(ABSENT(ErrorNumber Element:CED Segment[1]:LoopCDE[1]:Out) & PRESENT(ElementValue Element[1]:CDE Segment:LoopCDE[1]:Out), IF(NOT(ISNUMBER(ElementValue Element[1]:CDE Segment:LoopCDE[1]:Out)) , "028"))

     

    The ErrorNumber Element has an Item Subclass of Text. The ElementValue Element has an Item Subclass of Text.

     


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


  • 8.  Re: Numeric Validation on field with Text Subclass

    Posted 05/09/14 10:42 AM

    Originally posted by: mseedig


    I took out IF(ABSENT(ErrorNumber Element:CED Segment[1]:LoopCDE[1]:Out) which left me with =IF(PRESENT(ElementValue Element[1]:CDE Segment:LoopCDE[1]:Out) & NOT(ISNUMBER(ElementValue Element[1]:CDE Segment:LoopCDE[1]:Out)) , "028") and now it is giving me the results I was expecting.


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


  • 9.  Re: Numeric Validation on field with Text Subclass

    Posted 05/09/14 01:47 PM

    Originally posted by: Arun Ramamurthy


    Looks like the IF , ABSENT condition was not evaluating correctly and hence not going into the condition. Once you took it out , it may have started to work.


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