Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Go
New
Search
Notify
Tools
Reply
  
Xpath check
 Login/Join
 
Member
posted
Hi,

I am using iWay ISM 5.5,

I am trying to work out a condition which checks for presence of particular field in the transformer and maps it to the output.

root
child1 ABC /child1
child2 ABC /child2
/root

I am trying to use a IF condition like /root/child1 does have a value use that, else use /root/child2.

The IF condition works fine if the file contains /child1 under root,no matter the field is empty are not.

One such file contains

root
child2 ABC /child2
/root

Here lies the problem I am not getting the value of child2 as the child1 is not present.

Also i tried to using @Exists to check if child1 does exists use that, else child2, not working.

If the file doesn't contain child1 under root, I am not getting the value of child2

Please let me know if there is some way to get child2 value if the file doesnot contain child1

Syntax of the xml file i am using is correct, Above one is just a example.


iWay ISM 5.5/iWay ISM 6.0 on Windows.
 
Posts: 20 | Registered: April 11, 2011Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi,
Can you use [CODE] tags around the XML in your post for clarity...

What conditional operator are you using in the IF statement in the first example that is working? '=' ? '!=' ? '=='?


iWay 5.5 SMSP1 and 6.0.1 on Intel/Linux
 
Posts: 59 | Location: Birmingham, Blighty | Registered: October 30, 2007Reply With QuoteReport This Post
Member
posted Hide Post
Hi AdeH,
I am using iWay ISM 5.5(Transformer) on Windows 2003 server.

This is the original file,

<root>

<child1>ABC</child1>

<child2>123</child2>

</root>


Mapping condition is "If the string lenth of the expression root/child1 is != zero,then take the value root/child1, else take the value from root/child2".

This works fine is the file is of type above.
meaning I am getting the value ABC from the above IF condition.

But when the file is like this
<root>

<child2>123</child2>

</root>


that is without the child1 element,

The If condition resolves to false and it should take value from child2,this is not happening.

So I even tried the @Exists on child1 instead of string length check on child1, but I am not getting the value of child2.


iWay ISM 5.5/iWay ISM 6.0 on Windows.
 
Posts: 20 | Registered: April 11, 2011Reply With QuoteReport This Post
Member
posted Hide Post
I've noticed, that sometimes the transform functions do not work as they are supposed to in the mappings.

Create two elements,map one to child1 and second to child2, encapsulate them with invisible groups and set filters to show child1 group, if child1 exists( use @EXISTS function) and hide the child2 group, if child1 exists.


iWay Service Manager (6.0.1 - patch.62627)
DMC Version 7 Release 7
 
Posts: 12 | Registered: January 24, 2011Reply With QuoteReport This Post
Member
posted Hide Post
Thanks Igor,

Best option was to create two elements and also everything depends on the context setting on the group element.

The way it works in Transformer.


iWay ISM 5.5/iWay ISM 6.0 on Windows.
 
Posts: 20 | Registered: April 11, 2011Reply With QuoteReport This Post
  Powered by Social Strata  
 


Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.