[FX.php List] How do I contrain a found set?

Steve Winter steve at bluecrocodile.co.nz
Sun Aug 6 16:18:10 MDT 2006


Hi,

My advice, given that you want to do an OR search for the user entered
criteria, would be to remove the 
   $SearchParams->AddDBParam('Approved', 'Yes');
from the sFX request as at this point you don't want that there (in my view)

Once you've got the data and are at the point that you want to show the
records that have been found to the user, use php to filter the results,
essentially performing the 'find' that you're looking for...

foreach ($SearchData['data'] as $dataKey => $dataValue) {
  if($dataValue['Approved'][0] == 'Yes') {
    // display record here
  }
}

Hope this helps...

Cheers
Steve

> 
> Den 06/08/2006 kl. 5.27 skrev Edward L. Ford:
> 
> > Hello all,
> > How would one constrain a found set with FX?
> >
> > In my situation, the database has a group of fields that are  
> > considered search able for users, and then there's a special  
> > approved field, which can be set to either Yes or No -- end users  
> > should only see records that have Yes for the Approved field.
> >
> > Currently, there is a page for a user to perform a search on  
> > multiple fields.  I want to first perform a Find, using the  
> > criteria input into an HTML form -- I've already got that figured  
> > out.  Now I want to constrain the found set based on if Approved is  
> > set to yes or not.  How would I do that?
> >
> > Right now, I just have $SearchParams->AddDBParam('Approved',  
> > 'Yes'); in with the rest of the items input from the HTML POST.   
> > Because the search is a logical OR search, having it set this way  
> > returns all of the approved records -- since I set the Approved  
> > param record to yes, all approved records have that match, and thus  
> > are returned, essentially negating the criteria entered by a user  
> > into the HTML form.  (Does that make sense to anyone else but me?)
> 
> Hi Ed,
> 
> My way to get the result you're looking for is to include  
> $SearchParams->AddDBParam('Approved', 'Yes'); in the first query.  
> This turns the parameter into a logical 'and'.
> I know this is not exactly what you asked for since, it isn't a  
> second search constraining the found set. I must admit I don't know  
> how to do a second search constraning the found set (maybe it's  
> irrelevant since another web user might have changed the found set  
> with her own query inbetween).
> I  do believe however it will be faster as well as easier to get the  
> records you need in only one search.
> 
> 
> 
> ---
> Erik Andreas Cayré
> Spangsbjerg Møllevej 169
> DK-6705 Esbjerg Ø
> 
> Home Tel: +45 75150512
> Mobile: +45 40161183
> 
> 
> 




More information about the FX.php_List mailing list