Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax

Status
Not open for further replies.

Kmccormic

Technical User
Feb 13, 2009
20
0
0
US
Good Afternoon:

I'm pretty sure I'm missing some syntax error in here. I'm using Crystal 2008. I have 4 fields, I want to display one of the fields when the others are empty (null), then I want to group based on that output, but that comes later. The results only give me output when TaskLookup3 is null and there's also a value in TaskLookup4. There should be only 1 value at a time in any of these fields.

Here's the formula I'm using:
Whileprintingrecords;
If IsNull({TASKS.TaskLookup3}) then
{TASKS.TaskLookup4}
Else
If Isnull({TASKS.TaskLookup4})then
{TASKS.TaskLookup5}
Else
If IsNull({TASKS.TaskLookup5}) then
{TASKS.TaskLookup6}
Else
If isNull({TASKS.TaskLookup6}) then
{TASKS.TaskLookup3};

Thank you for any assistance you can provide.
 
Hi,
If one and only one of those fields will have a value ( BUT one definately WILL have a value) then you probably need to check for all the NULLs and then act on what is not NULL ( something like this):

Code:
If
(
IsNull({TASKS.TaskLookup6})
and
IsNull({TASKS.TaskLookup5}) 
and
IsNull({TASKS.TaskLookup4})
) 
then
{TASKS.TaskLookup3})
 
Else
 If
(
IsNull({TASKS.TaskLookup6})
and
IsNull({TASKS.TaskLookup5}) 
and
IsNull({TASKS.TaskLookup3})
) 
then
{TASKS.TaskLookup4}) 
Else 
If
(
IsNull({TASKS.TaskLookup6})
and
IsNull({TASKS.TaskLookup4}) 
and
IsNull({TASKS.TaskLookup3})
) 
then
{TASKS.TaskLookup5}) 
Else 
If
(
IsNull({TASKS.TaskLookup5})
and
IsNull({TASKS.TaskLookup4}) 
and
IsNull({TASKS.TaskLookup3})
) 
then
{TASKS.TaskLookup6})



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I think you should convert each value in a separate formula like this:

if isnull({TASKS.TaskLookup3}) then
"" else //or 0 if a number
{TASKS.TaskLookup3}

Then use a formula like this:

maximum([{@task3},{@task4},{@task5},{@task6}])

Alternatively, and more simply, you could try setting report options to "convert nulls to default" and then use the maximum on the fields themselves. This assumes only one field is populated.

-LB
 
Thank you Turkbear, thank you LB, both of those options work perfectly!

Regards,
Kara
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top