Choose Language Hide Translation Bar
Highlighted

## Getting Null in function argument variable

Hi,

I'm trying to create multiple formula column by passing "column name" and "formula" as an argument to function from a nested for loop which iterate over a list of list which contains these two values.

Function:

cal_2<<New Column(col_name,Numeric,Continuous,Format("Best",12),Formula(col_calc));

);

List:

cols={{"g IgG in Fr II+III Suspension",If(

:Name( "ISB Paste Source/Plasma Type" ) ==

:Name( "Fill Batch Paste Source/Plasma Type" ) ==

:Name( "SFB Paste Source/Plasma Type" ),

:Name( "Individual Fr 2+3 Paste Suspended (Kg) [Bk]" ) *

:Solution Weight After IM HOAc Addition,

Empty()

);},.....};

Loop:

For(i=1,i<=N Items(cols),i++,

For(k=1,k<N Items(cols[i]),k++,

cn=cols[i][k];cl=cols[i][k+1];

);show(cn,cl);

);

Log Report:

cn = "g IgG in Fr II+III Suspension";

cl = If(:Name("ISB Paste Source/Plasma Type") == :Name("Fill Batch Paste Source/Plasma Type") == :Name("SFB Paste Source/Plasma Type"), :Name("Individual Fr 2+3 Paste Suspended (Kg) [Bk]") * :Solution Weight After IM HOAc Addition, Empty());

col_name = "g IgG in Fr II+III Suspension";

col_calc = .;

**Not exactly NULL but a DOT(.).

Message was edited by: Vivek Sharma

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: Getting Null in function argument variable

you need nameexpr( ) in three places.

`add_col = Function( {col_name, col_calc},  Show( col_name, Name Expr( col_calc ) );  cal_2 << New Column( col_name, Numeric, Continuous, Format( "Best", 12 ),  Formula( Name Expr( col_calc ) )  ););cols = {{"g IgG in Fr II+III Suspension", If(  :Name( "ISB Paste Source/Plasma Type" ) ==  :Name( "Fill Batch Paste Source/Plasma Type" ) ==  :Name( "SFB Paste Source/Plasma Type" ),  :Name( "Individual Fr 2+3 Paste Suspended (Kg) [Bk]" ) *  :Solution Weight After IM HOAc Addition,Empty()) ; }};For( i = 1, i <= N Items( cols ), i++,  For( k = 1, k < N Items( cols ), k++,  cn = cols;  cl = cols[k + 1];  );  Show( cn, cl );  add_col( cn, Name Expr( cl ) ););`

nameexpr is needed when cl or col_calc is used in a context where it would normally be evaluated but what you want is the expression, unevaluated.

Craige
2 REPLIES 2

## Re: Getting Null in function argument variable

you need nameexpr( ) in three places.

`add_col = Function( {col_name, col_calc},  Show( col_name, Name Expr( col_calc ) );  cal_2 << New Column( col_name, Numeric, Continuous, Format( "Best", 12 ),  Formula( Name Expr( col_calc ) )  ););cols = {{"g IgG in Fr II+III Suspension", If(  :Name( "ISB Paste Source/Plasma Type" ) ==  :Name( "Fill Batch Paste Source/Plasma Type" ) ==  :Name( "SFB Paste Source/Plasma Type" ),  :Name( "Individual Fr 2+3 Paste Suspended (Kg) [Bk]" ) *  :Solution Weight After IM HOAc Addition,Empty()) ; }};For( i = 1, i <= N Items( cols ), i++,  For( k = 1, k < N Items( cols ), k++,  cn = cols;  cl = cols[k + 1];  );  Show( cn, cl );  add_col( cn, Name Expr( cl ) ););`

nameexpr is needed when cl or col_calc is used in a context where it would normally be evaluated but what you want is the expression, unevaluated.