0
votes

I have a table with 4 columns (Morning/Afternoon/Evening/Night)char(1) field data will Y/N in the column.

With this table I am creating a crystal report The output should be something like this:

if Morning and night is Y

Mor.........Night (nine dots)

If only Morning is Y 
Mor ( not dots)

If Afternoon and Evening
...Afternoon...Evening

if Morning and Evening
Mor......Evening(6 dots between mor and ever )

if Morning Afternoon evening and night is Y
Mor...After...Eve...Night

Like this I want in crystal report. I tried like this but not working properly in cystal report formula editor:

    local stringvar flag;
if {Table.Morning}='Y' then
flag:='Mor'
else
flag:='...'

if {Table.Afternoon}='Y' then
flag:=Flag+'after'
else
flag:=flag;

But is not as per desire.

1

1 Answers

0
votes

You can make use of multiple If-else if statements to accomplish this

if {Table.Morning}='Y' then 'Mor'
else if ({Table.Morning}='Y' and {Table.night}='Y')  then 'Mor.........Night'
else if ({Table.Afternoon}='Y' and {Table.Evening}='Y')  then 'Afternoon...Evening'
else if ({Table.Morning}='Y' and {Table.Evening}='Y')  then 'Mor......Evening'
else if ({Table.Morning}='Y' and {Table.Afternoon}='Y' and {Table.evening}='Y' and {Table.night}='Y')  then 'Mor...After...Eve...Night'
else ''