Gossamer Forum
Home : Products : DBMan : Customization :

Database Cleanup

Quote Reply
Database Cleanup
I am using DBMAN for order taking. I also have the long/short list mod.
We have a field called 'status'.
When an order has shipped, 'status' = shipped.
Right now when you hit 'list all' every record is listed. Is it possibe to list everything where 'status' does not equal 'shipped'?

Also, when you go to modify a record, there is a list all feature there as well. Is this the same routine? If not, I will also need the 'shipped' records to be eliminated from that listing as well.

Thanks in advance!
Quote Reply
Re: Database Cleanup In reply to
Certainly there is. However, it won't be a true "list all".

In your "list all" link, you'd specify something like, <A HREF="http://path/to/db.cgi?db=default&uid=default&status=notshipped&view_records=1">List All</A>

This won't actually do a list all, but it will display all records where status=notshipped.

Depending on how you have your html.pl file written, it may be in one place, or it may be in many places. Standard, you should be able to find it in sub html_footer. Just do a search for "list all" and that should tell you where all the links are at. Smile

Hope this helps!

--Lee

[This message has been edited by leisurelee (edited April 24, 2000).]
Quote Reply
Re: Database Cleanup In reply to
That will help, but the order status field has multiple choices. Is there a way to say not equal shipped?
To say 'not shipped' would only be one of the choices.

Thanks
Erick
Quote Reply
Re: Database Cleanup In reply to
Not sure if this will work but you might give it a try.

In sub html_record_long
<TR><TD colspan=2><$font>
|;
if ($rec{'Status'} ne "Shipped") {
print qq|Status: $rec{'Status'}|;
}
else { print qq| <input type="hidden" NAME="Status" VALUE="$rec{'Status'}">|;
}
print qq|</font></TD></TR>

Hope this helps Smile
Quote Reply
Re: Database Cleanup In reply to
The only way I can think of to set this up the way you want is to include all the possible options.

Let's say your possible options are

not shipped
pending
backordered
shipped

You would add the following to your List All link:

Code:
&status=not+shipped%7Cpending%7Cbackordered&re=1

The %7C part is a code for the | character, which means "or." You would place that between each of the options. Notice the + in "not+shipped." You need to add that in place of any spaces that may exist in your options. And, the thing that makes it all work is &re=1, which means to use a "regular expression" when you're searching.


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






Quote Reply
Re: Database Cleanup In reply to
This works fine.. One other question. I also need to list the ones where the status field is blank. How to I put that into the above command?
Quote Reply
Re: Database Cleanup In reply to
That's a very difficult thing to do. The only thing I can suggest is that you have an option of "None" and make that the default value for the field.


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






Quote Reply
Re: Database Cleanup In reply to
How do I make the default = **none**?

right now the first thing on the selection list when you are entering information is a "___". Can I replace the bar with '**None**'.

Thanks for all of your help

Erick
Quote Reply
Re: Database Cleanup In reply to
Yep. In db.cgi, sub build_select_field, change

Code:
$output = qq|<SELECT NAME="$column"><OPTION>---|;

to

Code:
$output = qq|<SELECT NAME="$column"><OPTION VALUE="None">---|;

This will make "None" the default value for all select fields. If you don't want other select fields to have this value, then you'll need to do some work in your .cfg file.

Define your field something like:

Code:
status => [7, 'alpha', 0, 20, 1, 'None', ''],

and add "None" to the options in %db_select_fields:

Code:
%db_select_fields = (
status => 'None,Pending,Shipped,Backordered'
);



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






Quote Reply
Re: Database Cleanup In reply to
Thank you so much! That worked great!

One problem that I noticed after I made the change is now when I go into search or modify a record and I enter in search info, it comes up saying "no matching records".

This is a real big problem. I made no other changes than the one you suggested.

PLEASE HELP !!!
Quote Reply
Re: Database Cleanup In reply to
You will probably have to go through and manually change all of the values in your .db file.

The second suggestion I made is probably better than the first one. Sorry. I wasn't thinking about searching when I made that suggestion.


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






Quote Reply
Re: Database Cleanup In reply to
I took the code out and replaced it with the original and the search features work again.

I think that something with that line of code for the changing the default is making the searching not work correctly.

Any Ideas??
Quote Reply
Re: Database Cleanup In reply to
Right. What you need to do is to change the field definition in your .cfg file -- that is, make "None" the default value when a record is added and add it to the options for the select field.

Then you'll need to go through and edit all of the current records to change the value of the empty ones to "None." I don't know of any way to do a search for no entry in a field.


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