I am using a subreport to display codes horizontally. These are my formulas:
FORMULA #1
WhilePrintingRecords;
StringVar chain := '';
NumberVar ChCnt := 1
FORMULA #2
WhilePrintingRecords;
StringVar Item:= {DoctorClientIndex.Client};
StringVar Chain;
NumberVar ChCnt;
if ChCnt = 1
then (ChCnt:= 2; chain := Item)
else
if Length(Chain) + Length(Item) > 254
then Chain := Chain else
chain := chain + '^' + Item
FORMULA #3
WhilePrintingRecords;
StringVar Chain
This works fine, except I need to add a code under certain conditions. I changed FORMULA #3 to the following:
If {Doctors.ClientInd} = 0 then StringVar Chain else
If {Doctors.ClientInd} = 2 then {Doctors.Doctors1}&'^'&StringVar Chain
Again, this works fine. The problem is when the Chain variable is blank I still need it to display the Doctors.Doctors1 by itself.
This is what the report looks like:
Doctors.Doctors1 Doctors.Client Ind Subreport
A1 2 A1^180061^D1
A104 0 C197^M180
A15 2
This is what it shoudl be:
Doctors.Doctors1 Doctors.Client Ind Subreport
A1 2 A1^180061^D1
A104 0 C197^M180
A15 2 A15