[FX.php List] And OR find

Steve Winter steve at bluecrocodile.co.nz
Tue Nov 21 18:28:31 MST 2006


Hi Bob,

That's an interesting approach that I hadn't considered, and so long as you 
could store the results of the calcualtions, it should work well, and 
require only one call to the WPE, and return the smallest set of found 
records...

I guess another approach would be to create a filed called (for example) 
yearSemester, which contained 2007fall than create related table, which 
contained one record for each year/semester combination, and contained a 
portal to the main db, using that key... then you would search the related 
table for 2007fall and 2007spring... probably just getting silly now ;-)

Cheers
Steve


> Here's another approach:
> 
> Create a calc field called spring_fall that says, if (semester" =  
> spring or semester=fall;"TRUE";"FALSE")
> 
> Then just do a query for the year and for spring_fall to equal "TRUE"  
> like this:
> 
> $query->AddDBParam('year',$year);
> $query->AddDBParam('spring_fall','TRUE');
> 
> I like to use calc fields to make my web queries easier...
> 
> Hope this helps,
> 
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> 
>    CONTACT US VIA INSTANT MESSAGING:
>       AIM or iChat: longterm1954
>       Yahoo: longterm_solutions
>       MSN: tech at longtermsolutions.com
>       ICQ: 159333060
> 
> 
> 
> On Nov 21, 2006, at 5:37 PM, Jerry Do wrote:
> 
> > Thanks Steve, That is exactly what I wanted.
> >
> > Thanks again
> >
> > Jerry,
> >
> >
> > On 11/21/06 5:33 PM, "Steve Winter" <steve at bluecrocodile.co.nz>
> wrote:
> >
> >> Hi Jerry,
> >>
> >> So if I understand correctly you want to find (for example)
> >> ( year = 2007 AND (semester = spring OR semester = fall))
> >>
> >> If so, then you can't do that with one FX.php query (as far as I  
> >> know).
> >> You've got a couple of options...
> >>
> >> 1. do two queries, (year = 2007 AND semester = spring) then (year  
> >> = 2007
> >> AND semester = fall), then join the two result sets using PHP, or  
> >> simply
> >> output them independently...
> >> 2. do one query, (year = 2007), then use PHP to filter just the  
> >> results
> >> that you want eg
> >>   foreach($results as $key => $value) {
> >>     if($value['semester'][0] == 'spring' || $value['semester'][0]  
> >> == 'fall') {
> >>       // do some stuff with the recrods, or put them into a new  
> >> array or
> >> something
> >>     } }
> >> 3. create a script in FMP that performs the serach, then pass those
> >> results out...
> >>
> >> Depending on exactly what you want to do with the output, and the  
> >> number
> >> of records in question, then I'd be inclined to go with either  
> >> option 1 or
> >> 2...
> >>
> >> Cheers
> >> Steve
> >>
> >>
> >>> Hello,
> >>>
> >>> I want to do a find for Year and (Fall or Spring).
> >>>
> >>> I'm using the following, but it didn't work.
> >>>
> >>> $q->AddParam('Year',$year);
> >>> $q->AddParam('Semester','Fall');
> >>> $q->SetlogicalOR();
> >>> $q->AddParam('Semester','Spring');
> >>>
> >>> Can it be done?  If so, please point me to the right direction.
> >>>
> >>> Thank you in advance,
> >>> Jerry
> >>>
> >>> _______________________________________________
> >>> FX.php_List mailing list
> >>> FX.php_List at mail.iviking.org
> >>> http://www.iviking.org/mailman/listinfo/fx.php_list
> >>
> >>
> >> _______________________________________________
> >> FX.php_List mailing list
> >> FX.php_List at mail.iviking.org
> >> http://www.iviking.org/mailman/listinfo/fx.php_list
> >
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list




More information about the FX.php_List mailing list