Lookup Functions Error: Unexpected null value

See attached graph. I am getting the following error:


    9:     $out.0.WD_Ref = lookup(Citizenship).get($in.0.c_country, $in.0.c_citizenship_status).WD_Ref_ID;
 
    ----------------------- CTL2 snippet -----------------------
     Unexpected null value.
----------------------------------------------------------------------------------------------------------
ERROR [main] - Execution of graph failed !

The ‘WD_Ref_ID’ has “^^^^^^^^^^” underneath it.

What did I do wrong :frowning:

Hi,

could you please attach the whole project (including data sample).

Thanks!

Here you go! Thanks!

I solved the problems, I changed the code to the following and worked:

if(lookup(Citizenship).get($in.0.c_country, $in.0.c_citizenship_status) == null)
	{ $out.0.WD_Ref = "not found";}
	else 
	{
	$out.0.WD_Ref = lookup(Citizenship).get($in.0.c_country, $in.0.c_citizenship_status).WD_Ref_ID;}

You can also use CTL’s conditional fail expression.

The code would look like this:


$out.0.WD_Ref = lookup(Citizenship).get($in.0.c_country, $in.0.c_citizenship_status).WD_Ref_ID : "not found";