cancel
Showing results for 
Search instead for 
Did you mean: 

RUNTIME EXCEPTION-Cannot cast null to boolean'.

Former Member
0 Kudos

Hi Friends,

I have the below mapping.The if condition is satisfied,even though 'then' value is going to the target field.

When i try to check the queue of the 'IF' function it is throwing error RUNTIME EXCEPTION-Cannot cast null to boolean

>splitbyvalue(eachvalue)----> then

->splitbyvalue(eachvalue)


>if---->target field

->mapwithdefault->else

Please help !!!

Regards,

Suresh.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

the input to the if standard function should be boolean value true or false.So use those standard function before if whose output is boolean.

SplitByValue does not return boolean value.

If you tell us your mapping requirement then we will help you to do the correct mapping.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Suresh ,

Do the mapping as


OTYPE -------->equalS------------->\
Constant[P]/                                  Constant[123]--->Then
                                       -->And -------------------> If ------- --- --> TELNO
FILTER------->equalS(StringFunction)--->/                  TELNO-->Else
 Constant[SD1]

former_member187339
Active Contributor
0 Kudos

Hi Suresh,

>splitbyvalue(eachvalue)----> then

->splitbyvalue(eachvalue)


>if---->target field

->mapwithdefault->else

What are you trying to do with the above mapping?What is the source field? Provide some more details

>>RUNTIME EXCEPTION-Cannot cast null to boolean

This is a valid error because you are passing "null" and it expected "boolean"

Regards

Suraj

Former Member
0 Kudos

Hi,

Thanks for the input!!

In the below mapping suppose both 'equals' are satisfied then constant value '123' will go to target field otherwise 'else' value will go.

constant(123)----


/

>concat>splitbyvalue(eachvalue)----


> then

E1K1456(source segment)-->\

equals/

>and--


/

---equals-\

concat>splitbyvalue(eachvalue)>if------>target field

E1K1456(source segment)----


>\

source field ->mapwithdefault->else

Regards,

Suresh.

Former Member
0 Kudos

Hi,

The if input of if-then-else function will except value only as 1(true) or 0(false). So after your split by value you need to convert the outcome to 1 or 0 as suitable to your logic.

Hope this helps.

Regards,

Siddhesh S.Tawate

former_member187339
Active Contributor
0 Kudos

hi Suresh,

>>both 'equals' are satisfied

after both equals put AND (under boolean inbuilt function) then put 'if'

Regards

Suraj

former_member200962
Active Contributor
0 Kudos
In the below mapping suppose both 'equals' are satisfied

Which equals function are you using. Looking at your requirement (where you are comparing two values....arithmatically) I suppose that you are using the equalS function and not the equals (boolean fuction). From the error it is clear that input to IF function is not boolean.

Regards,

Abhishek.

Former Member
0 Kudos

Hi,

I think my mapping is not done properly. Could you guys help me with the correct mapping--

In the source structure under the segment E1POO1 there are 3 fields whose condions are as below--

Source structure

E1P0006

--OTYPE

--FILTER

--TELNO

The OTYPE value should be 'P' and FILTER value shoud be 'SD1', then only the the constant number 123 should go to the target field TELNO(Present in the segment K1P9009 ONLY),othewise the value from TELNO of source should target field TELNO(Present in the segment K1P9009 ONLY).

Regards,

Suresh.

former_member200962
Active Contributor
0 Kudos
OTYPE ----->
                 --->equalS(StringFunctIon)-->
Constant(P)--->                                                                                Then(Constant: 123)
                                                                -->And(Boolean Function...O/P from equalS) --> IfWithElse ---> Target(K1P9009 --> TELNO)
FILTER --->                                                                                Else(TELNO)
                --->equalS(StringFunction)--->
Constant(SD1)-->

For multiple instances of source field (E1P0006) raise the context of the relevat fields....

Regards,

Abhishek.

Former Member
0 Kudos

Hi Suresh,

Please try the below code with the inputs to the function as otype, filter and telno respectively. Use context as the input type in the UDF

for(int i=0;i<OTYPE.length;i++)

{

if(OTYPE<i> == "P" & FILTER<i> == "SD1"

(

TELNO<i> = "123";

result.addValue(TELNO<i>);

)

else

result.addValue(TELNO<i>);

}

Regards,

Vishnu.