cancel
Showing results for 
Search instead for 
Did you mean: 

Create a node under condition

Former Member
0 Kudos

Hello everybody,

Here my scenario: I want to map from IDOC to CIDX document. Now one node should be created, when one field of the original message has a special value. The input field can have different values.

Now when I want to work with the CREATELF method, an error occurs: Target element could not be created, target needs a value for this element. When I map a Constant to the Node, it works, but the node is created everytime and I want that the target node is only created, when the input field has a special value.

I hope you can help me.

Thank you and best regards

Martin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

take source field compare it with a constant having your special value using equalS function........take the output of this to creatif and then map it to target field.......u may need to use removecontext and splitByValue between equalS and creatif if u are using this node in a heirarchical output.....

Former Member
0 Kudos

Hi,

@Rajeev: Now I am close to the solution, I don't get an error any more. But the node isn't created. Here is my target structure with occurences:

> Node A    (1...1)
   > Node B   (0...1)
      >Node C   (1...1)
         Field 1   (1...1)
         Field 2   (1...unbounded)

I want to create Node B when the condition is true. When I test the Message Mapping in ESR, Node A is created, but has no subnodes. In Node A, I just mapped a constant. What could be my mistake?

BR Martin

Edited by: Stampflmar on Dec 3, 2010 10:38 AM

Former Member
0 Kudos

Hi,

if your node B has the above special condition, then u may try to change context of source node to a higher level, by right-clicking your source node..........then send it to equalS function...........

Former Member
0 Kudos

Hi Raajev,

now I get the same error again, that field cannot be created because target xsd needs a value. But does that mean, that the node is created, but i have now a problem with my mapping of field one?

Because when I do some changements in the node B-mapping, everytime the node is created with subnode and field 1 with the right value, but the condition handling is missing. So I don't know right now what could be the reason for my problem.

BR Martin

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Whats the occurrence of that target node??Change its to 0..1 or 0..unbounded (depending upon ur requirement) and chk.

Thanks

Amit

former_member193376
Active Contributor
0 Kudos

When you map a constant it works,,but when there is a condition it does not work.

It looks like its a mandatory field and since your condition is not gettting satisfied its unable to create the node. put a true condition and check it.

Also as Mark suggested, if you want the value to be populated then do not use CREATEIF.

Thanks

S

Edited by: Saiyog Gonsalves on Dec 3, 2010 9:53 AM

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

The createIF node function will only work if you feed it Boolean values. If you really need to pass only a specific value, you can try using if or ifWithoutElse

.

Hope this helps,

Mark