July 26, 200619 yr I am writing a script to query a layout and i have to fields one called from and one called to tehy both conatins dates. In the find it supposed to return all the values who of customers who will be arriving (date in arrival field) between those two dates. I tried using a range but it won't let me use a field.
July 26, 200619 yr The script would work, but you would have to use global date fields so the data entered would be available in find mode (when defining fields in define database, choose storage options and click use global storage). Then, let your users specify, and then have them click the search button which executes a script similar to the following: Enter Find Mode[] Set Field[ArrivalDate ; FromDate & "..." & ToDate] Perform Find[]
July 26, 200619 yr Author I'm really having trouble geting this to work there must be a simple method of find all records that lie within a range of two dates?
July 27, 200619 yr You need to provide more information, such as: What table are in you in when your User performs the find. What are the type of fields? What is the table you want to search, ie, same table or another table or file? What is the field name you wish to search (and what is it's data type)? What does your script look like? Finding on date range is easy. If it isn't working then we need to pinpoint what is wrong. And we can't do that without more information. "tried using a range but it won't let me use a field. " Do you have the field's field control (right-click field) behavior allowing entry in Find mode?
July 27, 200619 yr Author ok i have a table called accommodation. I have a layout called finder arrival which has two fields on it which are in the accommodation table. from and to they are both date field with storage set to global. What I want to do is when a user enters a date in the from field and to field and clicks view a find is done on the layout arrivals layout (all fields are in the table accommodaion) to find anyone who has accomtype=hotel and there arrival date lies between the range from and to. Any ideas on how to do the find?
July 29, 200619 yr Hi Gaz 007, my apology ... this almost slipped by me. Genx' find should have worked but let's put it in the context of how you've described your setup. gFrom and gTo are global date fields on the layout called Finder Arrival. The gTo field actually should be called Thru (and that is how most people would interpret To but be clear what it means to you and your Users so you have no surprises in misinterpretation, ie, gTo is inclusive. This layout would also contain a button called VIEW with the following script attached: If [ not gFrom or not gTo ] Show Custom Dialog [ "Both From and To must contain a date" ] Halt Script End If Set Error Capture [ On ] Enter Find Mode [ ] ... uncheck pause ** Set Field [ arrivalDate ; gFrom & “..” & gTo ] Set Field [ accomType ; “Hotel” ] … can omit this step if you use Find Request (see note below) Perform Find [ ] … be sure you don’t accidentally choose Perform Find/Replace If [ not Get ( FoundCount ) ] Show Custom Dialog ["No Hotels available" ] Show All Records Halt Script End If Go To Layout [ “Arrivals” ] Decide whether you need to clear the globals if a Find is successful. If more than one User will be using the SAME client box, then I would clear them after the Go To Layout step at the end. Otherwise, I prefer to leave the globals in case the User wants to repeat a search and see what they tried the prior try (that client session). If you wish to clear the globals then just use Set Field [ gFrom ; "" ] and repeat with gTo. ** You can use a Find Request here to hold the accomType. Just open the Find Request, select accomType and type Hotel in the criteria box and Add. It is a bit easier than creating a Set Field [] step, but if I have part of the find criteria using Set Field [] then it is cleaner to have ALL the criteria using Set Field [] for consistency. LaRetta
August 1, 200619 yr Author the find only shows one result and I have to use the prev and next buttons is there anyway I can get it to print all the results on the one page or page/s if necessary
Create an account or sign in to comment