Gossamer Forum
Home : Products : DBMan : Customization :

reverse search

Quote Reply
reverse search
Hi everyone,

Can you help me with this problem of mine. I need dbman to do a special type of search for me. For example. I have two fields "TO" and "FROM". In the "TO" field I enter "London" and in the "From" field I enter "New York" and search. Now I want the search to give me two results.

In 1st case it should search with "To" as London and From as "New York".

In the 2nd case it should search with "To" as Newyork and search.

And finally show the results of both the search.

It will be a great help from the forum if you can help me.

bye

sandeep.
Quote Reply
Re: [cybermen] reverse search In reply to
I don't know that I understand what you want. Let me try to restate it and see if I got it.

First search:
Records with "London" in the To field and "New York" in the From field.

Second search
Records with "New York" in the To field and anything in the From field. (I'm assuming that "Newyork" was just a typo.)

Is that what you want? Is this the only type of search you would want to do on the database?


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] reverse search In reply to
I don't know that I understand what you want. Let me try to restate it and see if I got it.

First search:
Records with "London" in the To field and "New York" in the From field.

Second search
Records with "New York" in the To field and anything in the From field. (I'm assuming that "Newyork" was just a typo.)

Is that what you want? Is this the only type of search you would want to do on the database?

Hi you have understood my problem quite well.

Only thing is. the second search should be "new york" in the to field and "london" in the from field. Exactly reverse of the 1st search.

I hope now you understand what I mean exactly. Please let me know if u can help me.
Quote Reply
Re: [cybermen] reverse search In reply to
Before I do this, I want to be completely sure about what you're doing because it's not easy programming. Are you only going to search on the From and To fields? Not on date or time or anything else?


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] reverse search In reply to
Sorry ! I forgot to tell you one more thing. Yes there will be another field named keyword. The example of the keyword field will have data as names of days of the week like "friday" , "saterday" , "sunday" , "monday". The keyword field will be a part of both 1st and 2nd search.

Thanks for trying to help me.

Sandeep.
Quote Reply
Re: [cybermen] reverse search In reply to
I don't know that I'll have time to work on this until next week. If you have any other details, please post them. At the moment, as I understand it now, if I wanted a round trip between New York and London and wanted to leave on a Tuesday, I would also only get flights from London to New York that were on a Tuesday. And I wouldn't be able to designate which airline I wanted.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] reverse search In reply to
Hi JP,

I dont want a airline search also. But yes I want to have 2 date options one for the to journey and another for the from journey.

Thanks for all the effort you are giving to help me. I really appreciate it.

Sandeep.
Quote Reply
Re: [JPDeni] reverse search In reply to
Hi,

I am waiting for your help regarding the modification of the dbman script.

BYE

SANDEEP.
Quote Reply
Re: [cybermen] reverse search In reply to
I haven't forgotten you. It's just that I have to think about it a bit to know how to do it and I've got some other things that I'm doing right now that have to take priority.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] reverse search In reply to
Nice to know that you have not forgotten me. I understand that you are busy with your regular work. Actually this part of the script is very important for me so I thought I might remind you. Since you are busy can you explain me a bit about the logic so that I can do some coding myself.

bye

sandeep
Quote Reply
Re: [cybermen] reverse search In reply to
Okay.

This is off the top of my head. I would change sub view_records to be something like this:

Code:
sub view_records {
# --------------------------------------------------------
my ($status1, @hits1) = &query("view");

$temp{'To'} = $in{'From'};
$temp{'From'} = $in{'To'};
$in{'To'} = $temp{'To'};
$in{'From'} = $temp{'From'};
$in{'Date'} = $in{???};

# I'm not sure what to do here. I'm assuming that the Date field on the
# search form is the date for the outbound flight. In place of the ???
# you'll need to put in the name of the field from the search form that
# holds the date of the return flight.

my ($status2, @hits2) = &query("view");

# at this point, you have the outbound flights in an array called @hits1
# and the return flights in an array called @hits2.
# I don't know what you want to do with them from here. You can
# merge the arrays into one array called @hits and just continue on or
# you can change your display of search results so that both sets of
# flights would show at the same time, maybe in columns in a table
# or something.

# I also don't know what you want to do if the search comes back
# fine for one of them but not the other.

if ($status eq "ok") {
&html_view_success(@hits);
}
else {
&html_view_failure($status);
}
}


Maybe this will give you some ideas and you can finish it on your own.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.

Last edited by:

JPDeni: Jan 13, 2006, 5:57 PM