In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
  
Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel

Uncommon Knowledge - WC_Query_Template%

The template definition used when query mode is invoked. Note that initially this variable is empty but that it is constructed when query mode is invoked for the first time. If however the programmer has already loaded WC_Query_Template% appropriately, this will be used instead. Thus it is possible for query to invoke any template when the user requests it. This makes it possible for the programmer to put back in necessary edit checks and post prompt checks etc. It even makes possible the display of a radically different screen designed exclusively for query purposes.

The revised template can be loaded into WC_Query_Template% after initialisation. The template can either be prepared with the appropriate softkey and collector hooks or constructed on the fly using code like that provided below. Note that this code is intended as indicational only - it may require modification for your specific application. To use just call passing the name of the template to establish as the query window.


0001  Subroutine Create_Query_Template(Template_To_Use)
0002  /*
0003   Author        AMcA
0004   Date          Jan 1991
0005   Purpose       To build a query template from a template on file
0006  */
0007  
0008   $insert include,window_common%
0009   $insert include,lcfunctions
0010   Equ Delim$ To Char(247)
0011   Template_Rec = Xlate("TEMPLATES", Template_To_Use, "", "X")
0012   SOFTKEYS = "SFýChange Sort/SelectýQUERY.SUB,CUSTOMIZE" : @FM
0013   SOFTKEYS := "SFýSave Criteria as FilterýQUERY.SUB,FILTER.SAVE"
0014   Collector = "S" : @FM : "QUERY.SUB,CHECK.REDISPLAY" : @FM
0015   Collector := @FM : "S":@FM:"QUERY.SUB,MAKE.SELECT":@FM : "1"
0016   * Remove all processes other than pre query
0017   Pre = STR(@FM,5):WC_PREPROC%<6>
0018   /*
0019    If environment char not loaded may need default logic here
0020    Query_Char = Char(@Environ.Set<56>)
0021   */
0022   W_Env = STR(@FM,5):Query_Char
0023   Title = field(Template_Rec,Delim$,6):"- Query Window!"
0024   Y = (Template_Rec<1>+1)
0025   Prompts = FIELD( Template_Rec, @FM, 1, Y )
0026   Template_Rec[1,COL2()] = ""
0027   Prompt_Number = 1
0028   For Pointer = 2 To Y
0029    Prompts<Pointer,3> = "F" ; * Even symbolics become F type
0030    Prompts<Pointer,18> = "" ; * Remove Required flags
0031    Prompts<Pointer,22> = 1 ; * Make lower case
0032    Prompts<Pointer,4> = Prompt_Number ; Prompt_Number += 1
0033   Next
0034   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 6, 1, Title )
0035   * Add in collector details
0036   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 13, 1, Collector)
0037   * Don't bother locking or with required fields, keys, AMVs or recalc
0038   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 14, 1, 0 )
0039   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 16, 1, "" )
0040   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 17, 1, "" )
0041   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 19, 1, "" )
0042   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 21, 1, "" )
0043   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 22, 1, "" )
0044   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 23, 1, "" )
0045   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 24, 1, "" )
0046   * Add in SF1 and SF2
0047   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 26, 1, SF1:@FM:SF2)
0048   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 27, 1, SOFTKEYS )
0049   * Remove all preprocesses, post and rep
0050   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 30, 1, Pre)
0051   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 31, 1, "" )
0052   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 32, 1, "" )
0053   * Null Rec Map and start and disabled keys
0054   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 34, 1, "" )
0055   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 42, 1, "" )
0056   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 43, 1, "" )
0057   * Remove Perpetual
0058   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 45, 1, "" )
0059   * Set default mask
0060   Template_Rec = FIELDSTORE( Template_Rec, Delim$, 48, 1, W_Env)
0061   * And finally reassemble the template variable
0062   WC_QUERY_TEMPLATE% = Prompts:@FM:Template_Rec
0063  return

(Volume 3, Issue 8, Pages 11,12)
Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel