4 Replies Latest reply on Jul 29, 2013 12:47 PM by BatuhanGizer

    Search layout



      Search layout



           Before explaining, let me tell that I have read some forums about this topic but since I don't have much experience, I am having a hard time implementing what I read.  I have three things that I want to have in my search layout which are ProjectID, AccountID and two date fields which the user will enter dates if he/she wants to search between those dates (I only have one Date field in my table). I want to make a button so if the user wants to search, when clicked on it the new search layout will appear, then user will enter ProjectID AND/OR AccountID AND/OR dates if needed. Dates are not required, it is optional, but a ProjectID OR an AccountID or both are required.  2 buttons will be on the search layout as CANCEL or if any value is entered SEARCH.  

           Can anyone explain this step by step because as I read from other forums, I need to change some fields to global and I don't want to mess with my current database.

           Thanks in advance!

        • 1. Re: Search layout

               You don't change any fields to global storage. You add new fields with global storage that are only used by the user to enter their search criteria then the script uses the criteria entered by the user to create the search criteria in the corresponding non-global fields.

               That's what is shown in the sample find scripts here: Scripted Find Examples

          • 2. Re: Search layout

                 Ok so I tried to do what I want to have but I think I am doing something wrong.  First, I added two global storage fields with gID and gIDAccount to the same table(Accounts) where I want the search to occur.  I want it to search the field ProjectID and AccountID in my table. Then I created a layout named Search and added those two global storage fields.  I made the script, 

                 Go to Layout ["Search" (Account)]

                 Enter Find Mode []

                 Set Field [Account::ProjectID; Account:gID]  

                 Set Field [Account::ProjectID; Account:gIDAccount]

                 Set Error Capture [On]

                 Perform Find[]

                 If [not Get (FoundCount) // no records found]

                 Show Custom Dialog["No records were found by this search."]

                 End If


                 But nothing seems to happen except it only goes to the Search layout.

                 Step by step explanation would be much appreciated!

                 Thanks alot!

            • 3. Re: Search layout

                   Did you enter search criteria into the two global fields before running this script?

                   You need one button to do the go to layout [search] and then another button on this search layout that does the script shown above, but without needing the go to layout as you are then already on the search layout. And the final step of the script would be a go to layout step to take you back to the layout from which you started in order to see the results.

                   and this step seems to be in error:

                   Set Field [Account::ProjectID; Account:gIDAccount]

                   I would think that  it should be:

                   Set Field [Account::AccountID; Account:gIDAccount]

              • 4. Re: Search layout

                     It works! There was an error with the typo as well.