cancel
Showing results for 
Search instead for 
Did you mean: 

CR XI formula / variable problem

Former Member
0 Kudos

I am working on a formula with declared variables. In the first iteration of the formula it prints the variable correctly. In the second iteration of the formula when I include a view, it does not print out the contents of the variables. If you can look at the following code and figure out what is wrong, please let me know.

(Iteration 1: Working code)

If {?IncludeNationality}='y'

then

local numbervar b:={Constituents.BeginDate};

local numbervar e:={Constituents.EndDate};

local stringvar born:=if b>0 then totext(b,0,'') else '';

local stringvar died:=if e>0 then totext(e,0,'') else '';

if (b>0 and e=0) then 'b. 'born''

else

if (b>0 and e>0) then ''born'-'died''

else

''

(Iteration 2: Does not work)

If {?IncludeNationality}='y'

then

local numbervar b:={Constituents.BeginDate};

local numbervar e:={Constituents.EndDate};

local stringvar born:=if b>0 then totext(b,0,'') else '';

local stringvar died:=if e>0 then totext(e,0,'') else '';

local stringvar bl:={vwArtistGeography.Birth_Locale};

local stringvar ll:={vwArtistGeography.Living_Locale};

local stringvar dl:={vwArtistGeography.Death_Locale};

if (b>0 and e=0) then 'b. 'born' 'bl''

else

if (b>0 and e>0) then ''born' 'bl' - 'died' 'dl''

else

''

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I suspect that the field values from the view might be null. Modify the formula thus and see if it works.


If {?IncludeNationality}='y'
then
local numbervar b:={Constituents.BeginDate};
local numbervar e:={Constituents.EndDate};

local stringvar born:=if b>0 then totext(b,0,'') else '';
local stringvar died:=if e>0 then totext(e,0,'') else '';

local stringvar bl:= if not isnull({vwArtistGeography.Birth_Locale}) then {vwArtistGeography.Birth_Locale} else ' ';
local stringvar ll:=if not isnull({vwArtistGeography.Living_Locale}) then {vwArtistGeography.Living_Locale} else ' ';
local stringvar dl:=if not isnull({vwArtistGeography.Death_Locale}) then {vwArtistGeography.Death_Locale} else ' ';

if (b>0 and e=0) then 'b. '+born+' '+bl+''
else
if (b>0 and e>0) then ''+born+' '+bl+' - '+died+' '+dl+''

else
''

If bl, ll or dl come out as a space then the values are null. In CR if one value is NULL then the result is null.

Former Member
0 Kudos

Sanjay,

Thank you. The problem was the NULL fields that were in the view. I really appreciate your help.

Answers (0)