cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

RUNTIME EXCEPTION-Cannot cast null to boolean'.

Former Member
0 Likes
1,857

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.

View Entire Topic
Former Member
0 Likes

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 Likes

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 Likes

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 Member
0 Likes

hi Suresh,

>>both 'equals' are satisfied

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

Regards

Suraj

Former Member
0 Likes
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 Likes

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 Member
0 Likes
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 Likes

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.