This scenario is part of Actions Example 9: Dialog for Search Conditions.
To create the Search Results window, take these steps.
1. | In the catalog, create a Search Results subclass of the Scheduled Tours info window. |
2. | Using the Object Activator, compose the following action statement script for the Post-open property. |
myStartDate() and myNumberofDays() are user-defined properties for storing the values passed by the search dialog.
QueryDefine( )
query.start_date( FORMULA( ''>'||TO_CHAR(TO_DATE(:1,'YYYY/MMDDHH24MISS'),'DD-MM-YYYY')', myStartDate() ) )
query.return_date( FORMULA( ''<'||TO_CHAR(TO_DATE(:1,'YYYY/MMDDHH24MISS')+:2,'DD-MM-YYYY')', myStartDate(), myNumberOfDays() ) )
QueryExecute( )
Here are the steps for writing this script:
1. | Open the Property Inspector for the Search Results info window, select the Post-open property and click the Edit/Compose button to open the Object Activator. |
2. | Make sure the Search Results info window is selected in the Object Browser tree view (top-left). |
3. | Click the Properties tab page and click New. |
4. | In the New Property dialog, define a property with Name = myStartDate, Class = String and Argument Position = 1, and then click OK. |
5. | Add a second property with Name = myNumberOfDays, Class = String, and Argument Position = 2. |
6. | Click the Methods tab page. Select the QueryDefine method from the Methods list (put the cursor on any method in this list and type Q to scroll down), and then click Add. |
7. | Put the cursor on the query.start_date node in the Object Browser and click Add. |
8. | Put the cursor on the empty node below the query.startdate( ) action statement. |
9. | Click the Formula button. |
10. | Put the cursor on the empty node below the FORMULA action statement, and click the Edit button. |
'>'||TO_CHAR(TO_DATE(:1,'YYYY/MMDDHH24MISS'),'DD-MM-YYYY')
12. | Place the cursor on the empty node below this first parameter. |
13. | Select the Search Results info window in the Object Browser tree view. |
14. | Click the Properties tab page, and select the myStartDate property. |
16. | Proceed in the same way to add the two remaining action statements. |
The window is now ready to receive two search conditions and execute the query using those conditions.
See Next
Search by Start Date Dialog
|