TIP: Click on subject to list as thread! ANSI
echo: paradox
to: PETER READER
from: ALLAN WHITWORTH
date: 1995-05-24 10:47:00
subject: Adding procs to queries

PR>your needs -- an approach I hadn't thought of.  My application is going
PR>to have 2 kinds of users (not uncommon, in my experience) -- data entry
PR>people, who need speed and accuracy in entering the raw data but won't
PR>need to build queries and reports, and analysts who can be "trusted" to
PR>build their own queries and reports without hosing up the relationships.
PR>These people will need access to basic Paradox, but is there a way to
PR>keep them out of table restructuring, etc. in the app alias, while
PR>allowing them to play in their own yards all they want?
For Type II of your two types of users above have you seen this?
You may have already seen this if you've downloaded any sample
files from Borland's Download service.  The following
Query By Example PAL script allows your user to query one table
(maybe a temporary copy if you want to avoid DELETE, & CHANGETOs)
;Qbe.sc
;Use Paradox Query-By-Example to allow users to
;make ad-hoc queries. Allows the following keys:
;Check, Checkplus, Examples, adding tables, and
;selection criteria. Queries limited to one line per table
;This technique does not work with Paradox Runtime.
PROC Qbe()
PRIVATE
           Ans,      ;User keypress for messages
           Ntbl,     ;Name of additional table
           Procname, ;Procedure name
           Tblname   ;Name of first selected table
Procname = "Qbe"
CLEAR
;Select a table to query from working directory
SHOWTABLES
  ""
  "Highlight table to query and press Enter or Esc to quit"
TO Tblname
;Check for Esc. Exit if pressed.
IF NOT Retval THEN
   CLEARALL
   RETURN
ENDIF
;Clear the pulldown menu
SHOWPULLDOWN
ENDMENU
;Load query form on workspace
Menu {Ask} SELECT Tblname
;Enter selection criteria
WHILE True
  ;Remove old messages
  MESSAGE ""
  WAIT RECORD
    PROMPT "F2-Query, Esc-quit, F6-*, Alt/F6-*+, "+
           "F3-Down, F4-Up, F5-Example, F10-Pick"
  UNTIL "F2","Esc","Check","CheckPlus","F10",
        "UpImage","DownImage","Example","Dos","DosBig"
  SWITCH
    ;Process query
    CASE Retval = "F2" :
      DO_IT!
      ;Check window for Paradox error message if query misformed
      IF WINDOW()  "" THEN
        MESSAGE WINDOW()," - Press any key"
        Ans = GETCHAR()       MESSAGE ""
        LOOP
      ENDIF
      ;Check for empty Answer table
      IF ISEMPTY("Answer") THEN
        MESSAGE "No records fit your criteria.."
        SLEEP 1500         MESSAGE ""
        MOVETO Tblname
        LOOP
      ENDIF
      ;View Answer table if matches found
      WHILE True
        WAIT TABLE
          PROMPT "F2 - Finish looking"
        UNTIL "F2","Dos","DosBig"
        IF Retval = "F2" THEN
          QUITLOOP
        ENDIF
      ENDWHILE
      ;Move back to query form
      CLEARIMAGE
      MOVETO Tblname
    ;Finished with queries
    CASE Retval = "Esc":
      QUITLOOP
    ;Pass special keys to Paradox
    CASE Retval = "Check" OR Retval = "CheckPlus" OR
         Retval = "Example" OR Retval = "UpImage" OR
         Retval = "DownImage":
      KEYPRESS Retval
    ;Add another table from working directory
    CASE Retval = "F10":
        SHOWTABLES
          ""
          "Highlight table to query and press Enter "+
            "or Esc to quit"
        TO Ntbl
        IF Retval THEN
          Menu {Ask} SELECT Ntbl
        ENDIF
  ENDSWITCH
ENDWHILE
CLEARALL  ENDPROC
Qbe()
---
 * SLMR 2.1 * He shall come in the clouds, and every eye shall see Him.
--- QScan/PCB v1.16b / 01-0024
---------------
* Origin: (1:3407/14)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.