cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping a null value

Former Member
0 Kudos

My scenario is IDOC 2 IDOC,

How do I define the mapping, whereby if a particular field in the source is null then a constant u2018testu2019 should be passed to the target?

Thanks for the replies!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

try with create if function

regards

chandrakanth

Answers (5)

Answers (5)

sunil_singh13
Active Contributor
0 Kudos

Hi Raj,

This can be implemented by two ways

1)use Exists (it is a node function), it returns false if input to it is null.

so output of exists will be false if input is null .

use if withoutelse . and not(boolean function) after the output of exists so that if the value is null it will allow "test" to be passed as constant and if the input is not null it will pass nothing and as the second input pass 'test' as a constant .

2)Use CollapsContext : It returns blank([]) if input is null , you can compare the output of collapscontaxt with blank and give it as a one input to ifWithoutElse and other input will be Constant "test" .

3) u can write UDF for this .

Compare the input field with ResultList.CC

if true pass "test" if false pass watever u want

reward points if helpful

Thanks

sunil singh

Former Member
0 Kudos

Thanks for advice guys, I have configured as follows;

CIMTYP - Exists - IF,

Then CIMTYP - CIMTYP

Constant - Else - CIMTYP

[Test]

However when testing with a null value in the CIMTYP field, 'Test' does not appear in the target.

Am I missing something?

Thanks again,

Raj

Edited by: Raj Hundal on Jun 9, 2008 1:56 PM

Former Member
0 Kudos

Hi,

use the below map:

input CIMTYP and constant with null -> give it to Equals-> ifwithelse-> target

ifwithelse

true -> then pass input value

else-> constant(test)-> to output

chirag

Former Member
0 Kudos

Hi,

depends what do you mean with null value.

Exists function tests if there is any value.

For example:

<sourcemessage1>

<sourcevalue>

some value

</sourcevalue>

</sourcemessage1>

<sourcemessage2>

</sourcemessage2>

Using exists for sourcevalue will return true in first case and false in the second case.

If you have a special null value you have to test with the equalsS function like mentioned by Chirag.

Regards

Patrick

Former Member
0 Kudos

>>Using exists for sourcevalue will return true in first case and false in the second case

Exact reason you need to use the function "MapWithDefault".

Regards,

Jaishankar

Former Member
0 Kudos

Hey,

Use the following functions.

Exists(Node function)->if(boolean function)->then(pass the value)-> else("test")

rewards points if useful.

regards,

Milan

GabrielSagaya
Active Contributor
0 Kudos

sourcefield>exist()->Ifthenelse

(true) sourcefield---->targetfield

(false) Constant("TEST") --->TargetField

Former Member
0 Kudos

Hi,

you could use the exists function with an if function.

if ( exists (source value ) )

then source value

else constant

Regards

Patrick