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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenate multiple fields if value is not null using IF

Status
Not open for further replies.

MisterMo

Programmer
Mar 18, 2002
564
GB
Hi guys

I am trying to buld a formula to display only fields with values, I remember in the past (V7), using the if statement with no problems. but for some reason I can't make it work anymore

this is the formula

stringVar x;
x := '' ;

if isnull({SPD.MonAMStartTime})= false then

x := x & 'Morning: ' & totext(time({SPD.MonAMStartTime})) + ' to ' + totext(time({SPD.MonAMEndTime}));

if isnull({SPD.MonPMStartTime})= false then

x := x & ' - Afternoon: ' & totext(time({SPD.MonPMStartTime})) + ' to ' + totext(time({SPD.MonPMEndTime}))

else
x := '';


If I have values on both fields or on the second field it works else it doesn't

Any Idea?

Thanks for your help




Life is like a box of Chocolates..... So is Microsoft
 
Not sure if this is it, but try replacing

Code:
if isnull({SPD.MonAMStartTime})= false

with

Code:
if not isnull({SPD.MonAMStartTime})
 
Sorry my mistake I have just realised the the Else part is compared with the last if statement.

so by changing the

x=''; to x;

it worked just fine



Life is like a box of Chocolates..... So is Microsoft
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top