Normal Topic interactive searches (Read 688 times)
etejeira
Junior Member
**
Offline


No personal text

Posts: 60
Joined: Aug 6th, 2005
interactive searches
Jan 30th, 2006 at 8:32pm
Print Post Print Post  
I wonder if there is a way to program searches that ask the operator for input.
Lets say a report that has attached a search that requires input from the operator.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: interactive searches
Reply #1 - Jan 30th, 2006 at 9:05pm
Print Post Print Post  
The short answer is: Yes. The long answers depend on the specifics of what you need to do. Doing this for a regular search is a different technique than for an interactive report.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
etejeira
Junior Member
**
Offline


No personal text

Posts: 60
Joined: Aug 6th, 2005
Re: interactive searches
Reply #2 - Jan 30th, 2006 at 9:53pm
Print Post Print Post  
OK.
I need to generate reports that search in three fields.
One is a date field and the criteria is >xx/xx/xx;=
(The date chages for each report)
The second one is a text field and the criteria is = (that does not change and is the same for all reports)
The third one is a text field in a subform. The criteria is a word which is different for each report.
So what I need is for it to ask the operator to input the date in the first field and the word in the third field.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: interactive searches
Reply #3 - Jan 30th, 2006 at 10:45pm
Print Post Print Post  
Hello,

Below is how to do this with just one report. It can be expanded to include several reports. The code was written in the sample file Customers.db, so you will need to change the Form, Report, and Element names accordingly.

You will want to add a command button to your form. In it's on element entry event goes the following code.
Code
Select All
Var vDate as Date
Var vWord as String
Var vSuccess as Int

vDate = @Calendar(@Date, "Please choose a Date")
vWord = @PromptForUserInput("Please type in a Hobby", "Tennis")
GlobalValue("RunReport", "1")
GlobalValue("ReportDate", @Str(vDate))
GlobalValue("ReportWord", vWord)
vSuccess = @SelectTreeItem("Search Update Menu!Search (F7)") 



In your Forms on Retrieve Spec open event goes the following code. Since your third element is on a subform you will have to use FormFieldValue() to fill it in at the retrieve spec. The Date element must be filled in with FormFieldValue() so that the ">" and ";=" are inserted in the element.
Code
Select All
Var vSuccess as Int

If @ToNumber(@GlobalValue("RunReport")) = 1 Then
{
	FormFieldValue("Main Form", "Date_Entered", 0, ">" + @GlobalValue("ReportDate") + ";=")
	Company = "="
	Hobbies = @GlobalValue("ReportWord")
	vSuccess = @SelectTreeItem("Search Menu!Search Commands!Retrieve New Results (F10)")
} 



In your Form's On Form Entry event goes the follwoing code
Code
Select All
Var vSuccess as Int

If @ToNumber(@GlobalValue("RunReport")) = 1 Then
{
	vSuccess = @SelectTreeItem("Search Update Menu!Results Commands!Reports!Customers!Simple Report (Preview)")
	GlobalValue("RunReport", "0")
	GlobalValue("ReportDate", "")
	GlobalValue("ReportWord", "")
} 



If you would like a sample of this implemented send an e-mail to support@Lantica.com and ask RunReportPromptForCriteria.db

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
etejeira
Junior Member
**
Offline


No personal text

Posts: 60
Joined: Aug 6th, 2005
Re: interactive searches
Reply #4 - Jan 30th, 2006 at 10:50pm
Print Post Print Post  
Thanks.
I will ask for the .db file.
  
Back to top
 
IP Logged