Gossamer Forum
Home : Products : DBMan : Customization :

Will not skip records based on some fields

Quote Reply
Will not skip records based on some fields
I have placed some filters into DBMan so that certain records will not display for certain users, or if a certain date has passed, etc. To do this I have the following code in sub_query of db.cgi:

next LINE if ($today > &date_to_unix($values[$removedate]) and !$per_mod);
next LINE if ($values[$class] eq "Academic Faculty" and $per_staff);

These lines work! If I print the values above that I was doing the conditions on, they print the values for each record of the database. I am trying to add another filter that will allow each record to have an active or inactive status with the following code:

next LINE if ($values[$active] eq "No" and $per_view);

It does not work, and when I print out $values[$active], instead of printing a "Yes" or "No" value, it prints the ID # of the record?! I can't figure out why the other conditions work and this one doesnt. Any ideas?? Help!

Quote Reply
Re: Will not skip records based on some fields In reply to
I'm not a programmer but it does look like for this line:

next LINE if ($today > &date_to_unix($values[$removedate]) and !$per_mod);

you have the !

where in this line you don't:

next LINE if ($values[$active] eq "No" and $per_view);

maybe this would work?

next LINE if ($values[$active] eq "No" and !$per_view);

I hope it's as simple a fix as that Smile

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Will not skip records based on some fields In reply to
I gave that a shot and it didnt change anything :(

I think the problem lies in the last paragraph of what I wrote on the initial post. Why would some variables print out the actual values when I us $values[$whatever], while others print out the record number instead? I can't seem to find the logical connection.

Quote Reply
Re: Will not skip records based on some fields In reply to
You need to define each $whatever in default.cfg.

For example, you have probobly already set $class to the field number of the Class field, you will need to do the same with $active

Good luck!

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Will not skip records based on some fields In reply to
That did it, thanks!