Gossamer Forum
Home : Products : DBMan : Customization :

Conditional field problem

Quote Reply
Conditional field problem
I'm having a problem passing the value to a field that is dependent on another. In db.cgi in the sub add_record, I added after

unless ($per_admin) {
($auth_user_field >= 0) and ($in{$db_cols[$auth_user_field]} = $db_userid);
############################ The following:
if ($in{'Your_Rank'} eq ('Shodan' | | 'Nidan' | | 'Sandan' | | 'Yondan' | | 'Godan'))
{
$in{'Yudansha'} = 'Yes';
}
else {
$in{'Yudansha'} = 'No';
}
}
######################
same for the modify_record. I always get a result of 'No'. I dbl checked field names and the spelling of values. Am I missing something obvious? Thanks.
-Brian
Quote Reply
Re: Conditional field problem In reply to
You can't put the "or" conditions like that.

You need to say

Code:
if (($in{'Your_Rank'} eq 'Shodan') | | ($in{'Your_Rank'} eq 'Nidan') | |
($in{'Your_Rank'} eq 'Sandan') | | ($in{'Your_Rank'} eq 'Yondan') | | ($in{'Your_Rank'} eq 'Godan'))

I think you could also use

Code:
if ($in{'Your_Rank'} =~ /Shodan|Nidan|Sandan|Yondan|Godan/)

...

Yes. I just checked it. As long as the other options for Your_Rank don't have those other strings within them somewhere, the second one would be the one to use.

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








[This message has been edited by JPDeni (edited May 06, 2000).]
Quote Reply
Re: Conditional field problem In reply to
Ah, syntax. My eternal nemesis. Thanks.