Tom,
I had a similar question only regarding a report to print. Here is what
Karen sent to me.
Jim: I have a form where the user can do a variety of things.
There are checkboxes they can select, there are combo boxes
of values they can select, and there are free-form boxes where
they can type in things like dates. But they select at least one
thing in order to print. Here's how I do it:
1. In the program I initialize all the values to null, then bring
up the form to edit, like this:
SET VAR vBDate DATE = NULL, vEDate DATE = NULL, +
vStat TEXT = NULL, vClientID INT = NULL
EDIT USING printinvoice
2. There is a "print" and a "cancel" button on the form. The Print
button does all the checking and concatenating of the where clause:
IF vBdate IS NULL AND vEdate IS NULL +
AND vClientID IS NULL AND vStat IS NULL THEN
PAUSE 2 USING 'You did not enter any parameters to search for!' +
CAPTION 'ERROR!' ICON STOP OPTION MESSAGE_FONT_SIZE 11
RETURN
ENDIF
SET VAR vWhere TEXT = 'po IS NOT NULL'
IF vBDate IS NOT NULL THEN
IF vEDate IS NULL THEN
SET VAR vWhere = (.vWhere & 'AND ordate = .vBDate')
ELSE
SET VAR vWhere = (.vWhere & 'AND ordate BETWEEN .vBDate AND
.vEDate')
ENDIF
ENDIF
IF vClientID IS NOT NULL AND vClientID <> 0 THEN
SET VAR vWhere = (.vWhere & 'AND ClientID = .vClientID ')
ENDIF
... etc, you get the idea
PRINT reportname WHERE &vWhere
Hope that gives you some ideas!
Karen
James Belisle
________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of TOM HART
Sent: Saturday, April 16, 2011 7:15 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Multi column lookup
I currently use a form to look-up information from a table where field1
contains var1 and field2 contains var2, and if var1 is null then only
use field2 contains var2:
IF var1 IS NULL THEN
browse using tablename order by colunm1, column2+
where column2 contains .var2
ELSE
browse using tablename order by column1, column2+
where column1 contains .var1 and column2 contains .var2
ENDIF
This works fine, but now I want to have 4 variables. Is there a better
way to do this if say I want to leave 2 variables blank.
Tom Hart