Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query By Form
Message
From
10/12/1999 17:08:31
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Query By Form
Miscellaneous
Thread ID:
00302024
Message ID:
00302024
Views:
66
I'm trying my hand at Query By Form for the 1st time. To start out - I used Qbf.scx as a template and modified it to fit my program. In the data environment I have 10 tables. 1 is the company associated with the current record, 1 is main data (like totals) associated with the current record, and the other 8 hold (for lack of a better term) itemized data.

I'm trying to get a grip on the method 'Parsecondition', because when I use my vcr buttons, the only data that changes is the data associated with the itemized data table 1. Here is the code:

LPARAMETERS cCondition, cControlSource
LOCAL lcRetCondition, lcFieldName
IF TYPE('cCondition') = 'C'
cCondition = ALLTRIM(cCondition)
ENDIF

lcFieldName = SUBSTRC(cControlSource,(RATC(".",cControlSource)+1))

*!* NOTE: If you add a checkbox, radio button, or command group to
*!* the form, this routine will need to be changed to handle that
*!* specific datatype.

IF !EMPTY(cCondition) THEN
*!* If the type is Character or Memo, check to see if the
*!* user has entered a complex condition (if so, take that
*!* condition literally without any manipulation
IF TYPE('cCondition')$ "CM"
IF ("<" $ cCondition OR ;
"==" $ cCondition OR ;
"LIKE" $ cCondition OR ;
"<>" $ cCondition OR ;
"!=" $ cCondition OR ;
"#" $ cCondition OR ;
"=" $ cCondition OR ;
">" $ cCondition)
lcRetCondition = lcFieldName + cCondition
ENDIF
ENDIF
*!* If a complex condition wasn't found above (lcRetCondition will be empty)
*!* Then we need to create the WHERE condition ourselves
IF EMPTY(lcRetCondition)
*!* The RATC() Functions figure out the column to compare based on the
*!* controlSource of the control and any delimiters needed for the
*!* datatype are added around the values (not all conditions are
*!* assumed to be = when we construct them ourselves
DO CASE
CASE TYPE(cControlSource) $ "CM"
lcRetCondition = "ALLTRIM(" + lcFieldName + ")" + " = " + CHR(34) + cCondition + CHR(34)
CASE TYPE(cControlSource) $ "DT"
lcRetCondition = lcFieldName + " = {" + DTOC(cCondition) + "}"
OTHERWISE
lcRetCondition = lcFieldName + " = " + STR(cCondition)
ENDCASE
ENDIF
ELSE
lcRetCondition = ""
ENDIF

RETURN lcRetCondition


To be honest, I only understand this about 50%

Can anyone help?
Reply
Map
View

Click here to load this message in the networking platform