0

In my source schema I have an optional element, in my destination I have a required element.

If the source exists I have to map it directly to the destination, otherwise I need to generate a GUID and assign it to the destination. How do I do this?

Filburt
  • 17,626
  • 12
  • 64
  • 115
Jeremy
  • 44,950
  • 68
  • 206
  • 332

1 Answers1

3

If you're not using xslt for your mapping:

Test for existence using the "Logical Existence" functoid -> "Logical Not" functoid -> "Value Mapping" functoid. This checks to see if the node in the input does not exist, if it does not, then use the value mapping to set the value. You can put a hard coded value in the value mapper directly, or hook it to some other input. You may need to do a bit more work if your input node exists but is blank.

There are lots of examples on the internet.

Jay
  • 13,803
  • 4
  • 42
  • 69
  • I got that much, but it doesn't seem to allow me to take the ID if it does exist OR generate a new one if it doesn't. THe logical existance and value mapping can only ouput a single value. So I can get the "If" part of the solution, but not the "else" part. – Jeremy Jun 28 '12 at 18:36
  • 3
    you can have two value mapping functoids going to the same element in the source schema - as only one will be used depending on your condition. So, use a value map for if it exists and use another to pass you guid in if it doesn't... – TJ Amas Jun 28 '12 at 19:17