Hi:
I am facing a weird problem and I know I am missing something somewhere- basically I am trying to do a validation and hence need to loop over In array:x12envelope/ISA and out array :new820array/ISA.But after I loop over x12/ISA envelope I need to check if the ISA06(Sender) is ABC then only build the out array else do nothing. I thought this was fairly simple and put a branch there but everytime I seem to get this error:
java.lang.IllegalArgumentException: array element type mismatch
The reason being I think that in my test file there are 2 ISA segments and so x12envelope/ISA has ISA[0] from XYZ and ISA[1] from ABC. When I branch in the case of first ISA I do nothing and so the ISA shows up as *null.This I think is causing the problem. I am not sure I am explaing this right - so please free to ask me more questions.
Hello,
I would suggest you not you the new820array as the “out array”. You can use the in arrray and branch into the a sequence where the ISA06 is not “ABC”, use a reg expression to filter. You would then do an appendToDocumentList to build your new820array as it should have been declared blank in a map prior to the loop. Your result will only contain a list of what you approved as valid. If you start with 7 structures and 2 had the “ABC”, your final new820array would only have 5 strutures for later processing.
[MAP] (blank) -> new820
[LOOP]{in array} <- x12
-[BRANCH] {switch} <- x12/ISA/ISA06
–[SEQ] {label} <- ABC
–[SEQ] {label} <- $default
—[appendToDocumentList] {toList} new820, {fromItem} x12 -> {toList} new820
-[BRANCH] {switch} <- new820/ISA
–[SEQ] {label} <- $null
–[SEQ] {label} <- $default
—[MAP] ## further validate
Your other approach would be to keep your top code the same and filter on non presence in your later validation. So you would have:
You would continue down that last map then only work on the structure since you found it to exist. You can do extra splits on other parts of the structure. I still think the earlier pre filter is better to understand, manipulate and debug later.
Thanks - ultimately I had used a regular expression and done something like you have mentioned above. Took me some time but I did figure it out - part of the learning process I guess.
Though not significant, just wanna share my experience. I encountered the same error when i tried to manipulate the in & out array values in the Properties panel & run the service. I solved the issue by creating new loop and providing new out & in array values in the Properties panel.
P.S: I’m using wM IS 7.1.1