Gossamer Forum
Home : Products : DBMan : Installation :

Checking if there is anything in field

Quote Reply
Checking if there is anything in field
Hi,

One of the fields I will be using is the description field. Many of the records don't have a description, so I thought I would use the if command
Code:
if ( $rec{'Description'} ) {
print "blah,blah,blah";
}
The problem which I am having is, it will print blah,blah,blah no mater if there something, or nothing entered in the description field.

Did I not enter it wrong?

------------------
JFrost





Quote Reply
Re: Checking if there is anything in field In reply to
Your syntax is right.

Are you sure there's absolutely nothing in the field, not even a carriage return?



------------------
JPD


Quote Reply
Re: Checking if there is anything in field In reply to
Hi,

Right now, the way I set it is that if there is something in the description, display it. If there is nothing there, don't write anything. What is the syntax to see if there is something in that field. If there is, display it. If it's empty, don't just leave it blank but rather write Nothing Available. What do I have to add to
Code:
if ($rec{'Description'} ) {
print qq|$rec{'Description'}|;
}

------------------
JFrost





Quote Reply
Re: Checking if there is anything in field In reply to
Code:
if ($rec{'Description'}) {
print $rec{'Description'};
}
else {
print "Nothing Available";
}



------------------
JPD




[This message has been edited by JPDeni (edited March 10, 1999).]