AnsweredAssumed Answered

Creating a search form with multiple search criteria

Question asked by Parag on Jun 28, 2010
Latest reply on Jun 28, 2010 by S W

Title

Creating a search form with multiple search criteria

Post

I have 5 variables: Name, Age, Weight, Height and Place. Now my search script (below) can search a single variable, e.g. Name = Tom or Age = 18, etc. but it can't search multiple criteria, e.g. Name = Tom AND Age = 18.


Enter Browse Mode
Set Variable [ $sName; Value:Table::sName ]
Set Variable [ $sAge; Value:Table::sAge ]
Set Variable [ $sWeight; Value:Table::sWeight ]
Set Variable [ $sHeight; Value:Table::sHeight ]
Set Variable [ $sPlace; Value:Table::sPlace ]
Enter Find Mode [ ]
If [ $sName ≠ "" ]
Set Field [ Table::Name; $sName ]
Else If [ $sAge ≠ "" ]
Set Field [ Table::Age; $sAge ]
Else If [ $sWeight ≠ "" ]
Set Field [ Table::Weight; $sWeight ]
Else If [ $sHeight ≠ "" ]
Set Field [ Table::Height; $sHeight ]
Else If [ $sPlace ≠ "" ]
Set Field [ Table::Place; $sPlace ]
Else If [ ($sName ≠ "") and ($sAge  "") ]
Set Field [ Table::Name; $sName ]
Set Field [ Table::Age; $sAge ]
Perform Find [ ]
End If
Perform Find [ ]
If [ Get ( FoundCount ) = 0 ]
Show All Records
Show Custom Dialog [ Title: "No results found TestPB24Jun10"; Message: "No results have been found (TestPB24Jun10)"; Buttons:
“OK”, “Cancel” ]
Else
Go to Layout [ <unknown> ]
End If

 

I am unsure why doesn't function correctly:

 

Else If [ ($sName ≠ "") and ($sAge  "") ]

Set Field [ Table::Name; $sName ]
Set Field [ Table::Age; $sAge ]

 
















Outcomes