home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / database / informix / 3049 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  39.7 KB

  1. Path: sparky!uunet!europa.asd.contel.com!emory!emory!not-for-mail
  2. From: obelix.informix.com!johnl@emory.mathcs.emory.edu (Jonathan Leffler)
  3. Newsgroups: comp.databases.informix
  4. Subject: I4GL Modifications: Part 3 of 3
  5. Date: 25 Jan 1993 10:28:12 -0500
  6. Organization: Mailing List Gateway
  7. Lines: 791
  8. Sender: walt@mathcs.emory.edu
  9. Distribution: world
  10. Message-ID: <1k10ucINNoq0@emory.mathcs.emory.edu>
  11. Reply-To: obelix.informix.com!johnl@emory.mathcs.emory.edu (Jonathan Leffler)
  12. NNTP-Posting-Host: emory.mathcs.emory.edu
  13. X-Informix-List-ID: <list.1817>
  14.  
  15. #!/bin/sh
  16. # this is part 3 of a multipart archive
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file i4glmods continued
  19. #
  20. CurArch=3
  21. if test ! -r s2_seq_.tmp
  22. then echo "Please unpack part 1 first!"
  23.      exit 1; fi
  24. ( read Scheck
  25.   if test "$Scheck" != $CurArch
  26.   then echo "Please unpack part $Scheck next!"
  27.        exit 1;
  28.   else exit 0; fi
  29. ) < s2_seq_.tmp || exit 1
  30. echo "x - Continuing file i4glmods"
  31. sed 's/^X//' << 'SHAR_EOF' >> i4glmods
  32. X    the ENTRY or NOENTRY status of a field to be set, and the REQUIRED or
  33. X    NOT REQUIRED status too.  In fact, most of the input attributes should
  34. X    be settable dynamically (see also I4GL-I01).
  35. X
  36. X    I4GL-I02 was rated in class B because it would be very useful.
  37. X
  38. XI4GL-I03:
  39. X    One correspondent (not from CDI) requested that it be made easier to
  40. X    move from an INPUT statement to an INPUT ARRAY statement in a
  41. X    master/detail type screen, the implication being that the user should
  42. X    not have to hit the ACCEPT key to switch between the two.  This is
  43. X    largely under the programmer's control because the INPUT statement can
  44. X    have INPUT WRAP turned off and a function key can be trapped by ON KEY
  45. X    clauses to switch between the two statements.  Unless someone can
  46. X    clarify what is required, this is a non-request.
  47. X
  48. X    I4GL-I03 was rated in class F because it is not clear that there is a
  49. X    requirement.
  50. X
  51. XI4GL-I04:
  52. X    The I4GL help facility always takes over the entire screen when the
  53. X    user invokes it.  It would often be useful if the help facility could
  54. X    be programmed so that the information appeared in a window instead of
  55. X    taking over the whole screen.  A suitable syntax might be:
  56. X
  57. X        COMMAND "Command"
  58. X                "Explanation"
  59. X                HELP 34 IN WINDOW w_winname
  60. X
  61. X        COMMAND "Command"
  62. X                "Explanation"
  63. X                HELP 34 IN WINDOW AT x, y WITH r ROWS, c COLUMNS BORDER
  64. X
  65. X    The first variant would use the currently open (but not current) window
  66. X    w_winname to display the help message.  The second would create an
  67. X    anonymous window simply to display the help message.  However, if this
  68. X    was extended to a complete 6-option menu, the same information would
  69. X    have to be written too many times.  Thus, it should be possible to add
  70. X    a clause to the MENU statement itself.
  71. X
  72. X        MENU "Menuname" HELP 34 IN WINDOW AT x, y WITH r ROWS, c COLUMNS BORDER
  73. X
  74. X    The INPUT, INPUT ARRAY and DISPLAY ARRAY statements do not have this
  75. X    problem; their help is written once.  But SHOWHELP needs to be aware of
  76. X    the current help window so field-level help will appear in the same
  77. X    window as the general help.
  78. X
  79. X    I4GL-I04 was rated in class D because it would not be particularly easy
  80. X    to implement.
  81. X
  82. XI4GL-I05:
  83. X    It should be possible to determine the current value of any OPTION.
  84. X    The result should be able to be used to reset the OPTION later (see
  85. X    I4GL-L28).  This allows library code to change an option to its own
  86. X    value and then restore the value to what it was when the function was
  87. X    called.  (You should look at a graphics library such as GKS; speaking
  88. X    from memory, about 50% of the functions are queries, 40% are attribute
  89. X    setting, and the other 10% or so do the real work.)
  90. X
  91. X    I4GL-I05 was rated in class C but it should have been done long ago.
  92. X
  93. XI4GL-I06:
  94. X    A suggestion received from Adrian Flynn (adrianf@informix.com) was:
  95. X    Include an AFTER UPDATE attribute on fields which executes if (a) the
  96. X    cursor moves into a blank field enters a value and moves out of the
  97. X    field leaving a value in the field, or (b) the cursor moves into a
  98. X    field containing a value and leaves the field having changed the
  99. X    original value.  Do not behave like field_touched() which is true even
  100. X    if the user types the original value again.  You must still check to
  101. X    determine whether the field actually changed.  Execute AFTER UPDATE
  102. X    before AFTER FIELD.
  103. X
  104. X    Adding a whole new set of clauses to an INPUT or INPUT ARRAY statement
  105. X    is probably not a good idea, but providing a function field_changed()
  106. X    which does the job which field_touched() does half-heartedly would be
  107. X    better, and could be added without any major problems.  It would be
  108. X    used in the AFTER FIELD clause, and would only tell you if the value in
  109. X    the field had changed from the value which was current when the cursor
  110. X    entered the field.  If the user moved out of fieldA into fieldB having
  111. X    changed the value in fieldA, then field_changed() would be true in
  112. X    AFTER FIELD FieldA, but if the user moved the cursor out of FieldB back
  113. X    into FieldA, and then moved back out of FieldA to FieldB again without
  114. X    changing the value in FieldA, then field_changed() would be false on
  115. X    the second time through the AFTER FIELD FieldA clause.
  116. X
  117. X    I4GL-I06 was rated in class C but it shouldn't be very difficult to do.
  118. X
  119. X----------------------------------------------------------------------
  120. X
  121. XDISPLAY ARRAY
  122. X
  123. XI4GL-D01:
  124. X    See discussion for I4GL-I01.
  125. X
  126. XI4GL-D02:
  127. X    It should be possible for the programmer to specify which row in the
  128. X    program array should be the active row when the DISPLAY ARRAY starts.
  129. X    This can be achieved by setting NEXT PROGRAM ROW in the BEFORE DISPLAY
  130. X    block (see I4GL-D07).
  131. X
  132. X    I4GL-D02 was rated in class A because it should have been done long ago.
  133. X
  134. XI4GL-D03:
  135. X    It should be possible for the programmer to specify which row in the
  136. X    screen array should contain the cursor when the DISPLAY ARRAY starts.
  137. X    This can be achieved by setting NEXT SCREEN ROW in the BEFORE DISPLAY
  138. X    block (see I4GL-D07).
  139. X
  140. X    It would be possible for the programmer to make a mistake and specify
  141. X    that screen row 3 should contain program row 1, thus leaving two blank
  142. X    lines at the top of the displayed array.  This is not desirable, but
  143. X    there are two possible ways of dealing with the trouble.  One (probably
  144. X    the better one) is to report an error (inconsistent values of screen
  145. X    row and program row); the other is to quietly ignore the request, and
  146. X    in this case, the cursor would start in screen row 1 with program row 1
  147. X    displayed in it.
  148. X
  149. X    I4GL-D03 was rated in class A because it should have been done long ago.
  150. X
  151. XI4GL-D04:
  152. X    It should be possible for the programmer to specify which row in the
  153. X    program array should be the next active row in the DISPLAY ARRAY.  This
  154. X    can be achieved by setting NEXT PROGRAM ROW in an ON KEY or BEFORE ROW
  155. X    or AFTER ROW (see I4GL-D08) block.  This is effectively equivalent to
  156. X    I4GL-D02.
  157. X
  158. X    I4GL-D04 was rated in class A because it should have been done long ago.
  159. X
  160. XI4GL-D05:
  161. X    It should be possible for the programmer to specify which row in the
  162. X    screen array should be the next active row in the DISPLAY ARRAY.  This
  163. X    can be achieved by setting NEXT SCREEN ROW in an ON KEY or BEFORE ROW
  164. X    or AFTER ROW (see I4GL-D08) block.  This is effectively equivalent to
  165. X    I4GL-D03.
  166. X
  167. X    I4GL-D05 was rated in class A because it should have been done long ago.
  168. X
  169. XI4GL-D06:
  170. X    It should be possible to specify a HELP clause for a DISPLAY ARRAY.
  171. X    There also ought to be a CONTINUE DISPLAY statement -- whenever there
  172. X    is an EXIT XYZ statement, there should also be a CONTINUE XYZ
  173. X    statement.  (One exception is EXIT PROGRAM, though a CONTINUE PROGRAM
  174. X    (aka no-op) statement could be provided for complete consistency.)
  175. X
  176. X    I4GL-D06 was rated in class B but should have been done long ago too.
  177. X
  178. XI4GL-D07:
  179. X    It should be possible to specify BEFORE DISPLAY and AFTER DISPLAY
  180. X    clauses for a DISPLAY ARRAY.  These are necessary to provide full
  181. X    support for moving dynamically around the array (see also I4GL-D08, and
  182. X    I4GL-D02 .. I4GL-D05).  Both ARR_CURR() and SCR_LINE() should be
  183. X    usable in these clauses.
  184. X
  185. X    I4GL-D07 was rated in class B but should have been done long ago.
  186. X
  187. XI4GL-D08:
  188. X    It should be possible to specify BEFORE ROW and AFTER ROW clauses for a
  189. X    DISPLAY ARRAY.  These are necessary to provide full support for moving
  190. X    dynamically around the array (see also I4GL-D07, and I4GL-D02 ..
  191. X    I4GL-D05).  Both ARR_CURR() and SCR_LINE() should be usable in these
  192. X    clauses.
  193. X
  194. X    I4GL-D08 was rated in class B but should have been done long ago.
  195. X
  196. XI4GL-D09:
  197. X    It has been requested that there should be some way to move around a
  198. X    DISPLAY ARRAY faster than a row or page at a time.  One suggestion was
  199. X    that there should be some sort of search facility.  The ON KEY, NEXT
  200. X    PROGRAM ROW and NEXT SCREEN ROW options would allow the user to program
  201. X    in any such search if desired.  If a search mechanism was built-in,
  202. X    should it search down the first column only, or down any of the
  203. X    columns?  It will be difficult to specify this generally.
  204. X
  205. X    I4GL-D09 was rated in class E because it is not clear whether it can be
  206. X    implemented as a general facility.  The other improvements to DISPLAY
  207. X    ARRAY probably make it redundant anyway.
  208. X
  209. XI4GL-D10:
  210. X    It should be possible to have the current row highlighted without
  211. X    having to write code to change it.  A suitable syntax might be:
  212. X
  213. X        DISPLAY ARRAY array_var TO scr_array
  214. X            ATTRIBUTE (HIGHLIGHT CURRENT ROW)
  215. X
  216. X    I4GL-D10 was rated in class A because it should have been done long ago.
  217. X
  218. XI4GL-D11:
  219. X    It should be possible to display a subset of the elements in each row
  220. X    of the program array.  If the array elements have six fields, it should
  221. X    be possible to specify that only 4 of the fields should be displayed,
  222. X    and these need not be in the same order as they are stored in the
  223. X    array.  This feature would be even more important to INPUT ARRAY
  224. X    (I4GL-A13).  At the moment, if you need to maintain information off the
  225. X    screen about the rows of data on the screen, you have to use a second
  226. X    array in parallel with the first, and it is a real nuisance to have to
  227. X    keep the parallel array synchronized with the array being used by the
  228. X    INPUT ARRAY.
  229. X
  230. X    Given the advantages of using ARRAY[n] OF RECORD LIKE Table.*, it might
  231. X    be beneficial if the specified elements could come from two separate
  232. X    arrays.  This could be very tricky to implement, however.  At the very
  233. X    least, the code would have to be aware that there were two independent
  234. X    arrays.  This would be useful in conjunction with I4GL-A16.
  235. X
  236. X    I4GL-D11 was rated in class B because it should have been done long ago
  237. X    but is not necessarily all that easy to do.  However, there is room to
  238. X    suppose that the underlying C code always has supported the required
  239. X    functionality, but it simply hasn't been made accessible to the I4GL
  240. X    programmer.
  241. X
  242. X----------------------------------------------------------------------
  243. X
  244. XINPUT ARRAY
  245. X
  246. XI4GL-A01:
  247. X    See discussion of I4GL-D10.
  248. X
  249. XI4GL-A02:
  250. X    See discussion of I4GL-I01.
  251. X
  252. XI4GL-A03:
  253. X    See discussion of I4GL-I02.
  254. X
  255. XI4GL-A04:
  256. X    See discussion of I4GL-D02.
  257. X
  258. XI4GL-A05:
  259. X    See discussion of I4GL-D03.
  260. X
  261. XI4GL-A06:
  262. X    See discussion of I4GL-D04.
  263. X
  264. XI4GL-A07:
  265. X    See discussion of I4GL-D05.
  266. X
  267. XI4GL-A08:
  268. X    It should be possible for the programmer to enable or disable the
  269. X    INSERT and DELETE keys independently of each other.  There are times
  270. X    when the user should not be allowed to change the number of rows in the
  271. X    data in the INPUT ARRAY, though some of the fields in the data may be
  272. X    changed.  A suitable syntax would be:
  273. X
  274. X        INPUT ARRAY var_array WITHOUT DEFAULTS FROM scr_array
  275. X            ATTRIBUTES (ENABLE INSERT KEY, DISABLE DELETE KEY)
  276. X
  277. X    I4GL-A08 was rated in class A because it should have been done long ago.
  278. X
  279. XI4GL-A09:
  280. X    It is often the case that an array has to be declared big enough to
  281. X    take the largest expected list of items (but see I4GL-L02), but the
  282. X    user should not be allowed to extend the selected list of rows during
  283. X    an update (INPUT ARRAY WIHOUT DEFAULTS).  Suppose the array was
  284. X    dimensioned as 40 rows, but only 20 rows were selected.  The INSERT key
  285. X    can be disabled (I4GL-A08), but the user can still move to the bottom
  286. X    of the array and then extend the list.  I4GL should have a function
  287. X    such as SET_MAX_COUNT which adjusts the effective size of the array.
  288. X    Obviously, the programmer should not be allowed to do SET_MAX_COUNT(60)
  289. X    for an array of 40 entries.
  290. X
  291. X    This functionality can be provided in C4GL fairly simply; it only
  292. X    requires a small modification to a header file and adding an extra file
  293. X    to the Informix libraries, but it cannot be done in R4GL.
  294. X
  295. X    I4GL-A09 was rated in class A because it should have been done long ago
  296. X    and is trivial to do.
  297. X
  298. XI4GL-A10:
  299. X    The program should be able to insert one or more rows of data into the
  300. X    middle of the program array without having to program the moves manually.
  301. X    Likewise, it should be able to remove data from the middle of the array.
  302. X    The display should catch up appropriately.  This should probably be done
  303. X    by a pair of routines:
  304. X
  305. X        CALL DELETE_ROWS(array, offset, count)
  306. X
  307. X        CALL INSERT_ROWS(src_array, src_offset, src_count,
  308. X                            dst_array, dst_offset)
  309. X
  310. X    I4GL-A10 was rated in class A because it should have been done long ago.
  311. X
  312. XI4GL-A11:
  313. X    The program should be able to override the use of the INSERT or DELETE
  314. X    key, even when they are enabled.  There are circumstances where the
  315. X    user may not delete certain rows in the data even though some rows can
  316. X    be deleted, and there are other circumstances where a user may not
  317. X    insert data before particular rows even though they may be able to
  318. X    insert data before other rows.  The programmer should be able to
  319. X    control this behaviour.  The BEFORE INSERT and BEFORE DELETE clauses
  320. X    are where the control is needed (though BEFORE INSERT is also used when
  321. X    the array is being extended); the appropriate syntax might be OVERRIDE
  322. X    DELETE or it might be CANCEL INSERT.  Other suggestions welcome.
  323. X
  324. X    I4GL-A11 was rated in class A because it should have been done long ago.
  325. X
  326. XI4GL-A12:
  327. X    See discussion of I4GL-D09.
  328. X
  329. XI4GL-A13:
  330. X    See discussion of I4GL-D11.
  331. X
  332. XI4GL-A14:
  333. X    It would be useful on occasion to be able to specify a unique key in a
  334. X    screen array record, so that if the user enters a duplicate key, an
  335. X    error will be generated.  This would mean that the developer doesn't
  336. X    have to check for the uniqueness of keys after they are entered.  This
  337. X    is typically performed in an AFTER FIELD clause using a loop to check
  338. X    if there is a duplicate.  A suitable syntax might be:
  339. X
  340. X        INPUT ARRAY var_array WITHOUT DEFAULTS FROM scr_array
  341. X            PRIMARY KEY col01, col02
  342. X                { WITH | WITHOUT } DUPLICATE SUPPRESSION
  343. X
  344. X    I4GL-A14 was rated in class D because it is not clear how much call there
  345. X    is for the feature.
  346. X
  347. XI4GL-A15:
  348. X    During INPUT ARRAY, the user should be allowed to move up from the last
  349. X    row of an array if it is blank (or perhaps from any blank row of an
  350. X    array), even if the fields have REQUIRED attributes or the columns are
  351. X    NOT NULL.  For example:
  352. X
  353. X            Customer No   Name
  354. X          1 [123]         [Flynn      ]
  355. X          2 [456]         [Leffler    ]
  356. X          3 [   ]         [           ] <--- Cursor here (last row)
  357. X          4 [   ]         [           ]
  358. X
  359. X    If the user moves onto row 3, the cursor cannot be moved back to row 2
  360. X    if there are REQUIRED attributes on any of the fields or NOT NULL on
  361. X    any of the columns.  Ideally, the cursor should not be allowed to move
  362. X    onto row 4 until 3 is filled in.  Currently this functionality requires
  363. X    excessive code.
  364. X
  365. X    The features for handling NEXT SCREEN ROW and NEXT PROGRAM ROW may be
  366. X    sufficient to overcome this problem without much coding.
  367. X
  368. X    I4GL-A15 was rated in class C because it is not clear whether it is
  369. X    really needed if all the other features are implemented instead.
  370. X
  371. XI4GL-A16:
  372. X    It would be useful if there was a simple method of determining which
  373. X    rows in the array were changed, deleted and inserted during INPUT ARRAY
  374. X    WITHOUT DEFAULTS, with a view to making the database update operations
  375. X    more efficent.  Currently most users DELETE everything and then INSERT
  376. X    what is in the array as there is no change tracking mechanism.  The
  377. X    overheads are too much for this method.
  378. X
  379. X    Tracking inserted and updated rows should be relatively simple using
  380. X    I4GL-D11 to retain an extra column which marks the rows which are
  381. X    inserted or deleted.  Tracking deleted rows is more difficult; the onus
  382. X    might be on the programmer to copy the keys of the deleted rows into a
  383. X    separate array which could be used afterwards to control the deletions.
  384. X    The post-processing should probably delete the date, then insert the
  385. X    data, then update the data, for who can tell whether the user deleted a
  386. X    row and then re-keyed it.
  387. X
  388. X    I4GL-A16 was rated in class F because it is not clear how it could be
  389. X    implemented, nor whether it is really necessary given the other
  390. X    changes to INPUT ARRAY.
  391. X
  392. X----------------------------------------------------------------------
  393. X
  394. XCONSTRUCT
  395. X
  396. XI4GL-C01:
  397. X    (The original mail message uses AUTOWRAP consistently; I think AUTONEXT
  398. X    is intended).  David Vessell (dave@bradley.bradley.edu) asks: I would
  399. X    like to see AUTONEXT capability restored to the CONSTRUCT statement.
  400. X    Originally it was allowable, but Informix considered it a bug and fixed
  401. X    it, which absolutely killed us here, because in our applications here
  402. X    we do a lot of querying on fixed-length fields, one value at a time.
  403. X    The users never use ranges of data or anything else like that.  Because
  404. X    of this fix, every field now must be followed with a carriage return in
  405. X    order to move to the next field.  I don't see why this should be an
  406. X    either-or thing.  It should be definable in the screen form.  If you
  407. X    need the query window at the bottom for larger-than-field search
  408. X    criteria, specify it in the screen form.  But having AUTONEXT
  409. X    capability restored would be a godsend to us.
  410. X
  411. X    If the users' queries are that simple, you could use INPUT to get the
  412. X    relevant values (with AUTONEXT working a treat), and you could build
  413. X    the query yourself (and it is not very hard to do it).  If AUTONEXT
  414. X    were reinstated in CONSTRUCT, how could a more experienced user request
  415. X    all the values in the range [A-E] in a single character field?  If it
  416. X    is restored, it must be restored under control of an attribute, and the
  417. X    default in the absence of the attribute should be the non-AUTONEXT
  418. X    behaviour.  A suitable syntax for the field attribute might be:
  419. X
  420. X        { WITH | WITHOUT } CONSTRUCT BUFFER
  421. X
  422. X    I4GL-C01 was rated in class F because it is not clear that it is a good
  423. X    idea.
  424. X
  425. XI4GL-C02:
  426. X    This is another bug fix request.  The get_fldbuf() function should
  427. X    retrieve all of the condition typed by the user and the DISPLAY in
  428. X    BEFORE CONSTRUCT should restore all of it, assuming it was saved into a
  429. X    long enough character string (and CHAR(78) should be big enough because
  430. X    the window cannot be wider than that, in general).  In 4.10.UC1, if you
  431. X    enter a date range into a field and save it and then restore it on the
  432. X    next CONSTRUCT, the condition is typically not valid, so the user has
  433. X    to retype it afeter all, which defeats 99% of the object of the
  434. X    exercise!
  435. X
  436. X    I4GL-C01 was rated in class A because it is a bug fix.
  437. X
  438. X----------------------------------------------------------------------
  439. X
  440. XPICKLISTS
  441. X
  442. XI4GL-K01:
  443. X    I4GL should provide a 4GL facility which allows a user to choose the
  444. X    correct value from a list generated from some table in the database.
  445. X    The discussion in CDI was definitely in favour of such a facility, but
  446. X    was short on concrete suggestions about what should actually be
  447. X    provided.  This section sets out some of the requirements which a
  448. X    picklist facility should provide.
  449. X
  450. X    * A picklist should appear in a window.  The window will normally be
  451. X      bordered.  The window will normally be positioned by the programmer.
  452. X      The window should not need to be named by the programmer.
  453. X
  454. X    * Two modes of window sizing are desirable.  Mode-1 sizes the window to
  455. X      suit the list of values which were retrieved.  Mode-2 fixes the size
  456. X      of window.  (The discussion in CDI implied that Mode-1 was all that
  457. X      was necessary; however, some customers prefer all the popup windows
  458. X      to appear at the same place and to cover most of the screen, so
  459. X      Mode-2 is also desirable.)  In Mode-1, there may be a maximum size
  460. X      which the pogrammer wishes to use.  Normally, a single program will
  461. X      either use Mode-1 or Mode-2 for all its picklists and not a mixture,
  462. X      but a mixture should be allowed.
  463. X
  464. X    * It must be possible to specify other appropriate window attributes.
  465. X      This would certainly include an option to specify that the current
  466. X      row should be highlighted.
  467. X
  468. X    * There are two sets of characteristics describing the behaviour of the
  469. X      picklist.  First, some picklists generate the list of values
  470. X      unconditionally, whereas others should allow the user to perform some
  471. X      sort of query to select the values to be displayed.  These might be
  472. X      termed conditional and unconditional picklists.  Second, most
  473. X      picklists should return a single value, but occasionally it is useful
  474. X      to have the ability to select a list of values.  These might be
  475. X      termed single-choice and multi-choice picklists.  A mechanism should
  476. X      be devised to allow a list of values to be returned.
  477. X
  478. X    * For a conditional picklist, the columns on which the query can be
  479. X      expressed should be definable.  These may not coincide with the
  480. X      displayed columns, which suggests that the conditional picklist is
  481. X      best implemented by the programmer providing the query facility in
  482. X      ordinary I4GL and then invoking the standard picklist functionality
  483. X      with the query so generated.  Conditional picklists are not given
  484. X      further consideration.
  485. X
  486. X    * The picklist should have an optional title.  It should also contain a
  487. X      user-definable message to indicate what the user should do next.  The
  488. X      displayed columns may need to be annotated.
  489. X
  490. X    * The space needed to store the displayed values should not be a fixed
  491. X      size array.  Indeed, the programmer should not have to manually
  492. X      allocate the required space at all.  The programmer may specify an
  493. X      upper bound on the number of rows available to the user.  If the list
  494. X      is larger than this bound, it would be truncated.
  495. X
  496. X    * The data should be shown in some programmer-defined order.
  497. X
  498. X    * The table, the primary key column(s) to be returned, and the columns
  499. X      to be displayed should be definable for a picklist.  The normal use
  500. X      of a picklist is to look up values in a table with two relevant
  501. X      columns -- a code and a description.  However, compound primary keys
  502. X      and multiple description columns cannot be rules out.  Nor can the
  503. X      possibility that the relevant display involves data from multiple
  504. X      tables.  One way around that would be to use a view.  Views should be
  505. X      supported as an alternative to a table without any changes being
  506. X      necessary.  However, that may be too restrictive, and so a general
  507. X      SELECT statement may be required.  This also allows for ordering to
  508. X      be handled straight-forwardly.
  509. X
  510. X    * Should a picklist have to regenerate its data every time it is
  511. X      invoked?  This is a non-trivial question.  If the data in the table
  512. X      changes regularly, then the list should be regenerated afresh every
  513. X      time it is used, but most picklists will be used on tables which are
  514. X      essentially unchanging, and the cost of regenerating (and
  515. X      re-ordering) the data may be non-negligible.  This suggests that
  516. X      there should be an option to have a regeneratable list, but that the
  517. X      default should be to re-use the list on subsequent invocations of the
  518. X      picklist.
  519. X
  520. X    * The discussion in CDI implied (I think) that the all this should be
  521. X      definable using a single statement which need not be in a separate
  522. X      function (so it could be used in an AFTER FIELD clause of an INPUT
  523. X      ARRAY, for example).  This is a laudable objective, though it seems
  524. X      probable that good engineering practice would factor the statement
  525. X      into a subroutine so that the same picklist could be use in more than
  526. X      one place.
  527. X
  528. X    * Given these requirements, the syntax below could be used for a
  529. X      picklist.  Although there is no obvious universal method for
  530. X      returning a list of choices, the multi-choice picklist is supported
  531. X      by this syntax; the features required to provide such support are
  532. X      discussed below.
  533. X
  534. X        PICKLIST
  535. X            HELP 999
  536. X            WINDOW AT x, y WITH {MAX} r ROWS, c COLUMNS
  537. X                CURRENT ROW HIGHLIGHTED,
  538. X                NO BORDER,
  539. X                COMMENT LINE LAST,
  540. X                TITLE LINE FIRST + 1,
  541. X                LABEL LINE FIRST + 3
  542. X            CENTRE TITLE "Title of popup" REVERSE
  543. X            COMMENT "Use arrow keys to find the required value "
  544. X                    "and press the ACCEPT key"
  545. X                    DIM
  546. X            SELECTION "SELECT T1.Col01 Column1, T1.Col03 Column2,"
  547. X                      " T2.Col19 Column3, T2.Col05 Column4, T2.Col01 Column5"
  548. X                      " FROM TableA T1, TableB T2"
  549. X                      " WHERE T1.Col02 = T2.Col04"
  550. X                      " ORDER BY Column1, Column2, Column5"
  551. X                REGENERATE
  552. X                MAX SELECTED ROWS 100
  553. X                AUTORETURN
  554. X            DISPLAYING
  555. X                Column1 USING "&&&&&",
  556. X                Column2 WORDWRAP 30,
  557. X                Column3 TRUNCATE 20,
  558. X                Column4
  559. X            LABELLED "Label1", "Label2", "Label3", "Label4"
  560. X            PRIMARY KEY Column1, Column2
  561. X            -- End of the "fixed" part of a PICKLIST
  562. X
  563. X            -- The returning clause is the simplest variable component
  564. X            -- of the PICKLIST.  Other clauses are of the "traditional"
  565. X            -- BEFORE PICKLIST, AFTER PICKLIST, BEFORE ROW, AFTER ROW,
  566. X            -- ON KEY (keylist) types.  See the discussion below.
  567. X            RETURNING variable1, variable2
  568. X
  569. X        END PICKLIST
  570. X
  571. X    * The SELECTION and PRIMARY KEY clauses are mandatory, and the
  572. X      remainder are optional.  There must either be a RETURNING clause or
  573. X      an ON KEY (KEY_SELECT) clause.
  574. X
  575. X    * The WINDOW section is optional.  If it is not specified, the window
  576. X      defaults to a bordered window located at 2, 2 with unconstrained
  577. X      Mode-1 sizing.  Mode-1 operation is supported when the MAX keyword is
  578. X      used; Mode-2 operation is supported when it is omitted.  The WITH
  579. X      clause is optional, and if it is omitted, then unconstrained Mode-1
  580. X      operation is implied.
  581. X
  582. X    * Since the default behaviour is BORDER, the attribute NO BORDER is
  583. X      needed to indicate that the window should not have a border
  584. X      (I4GL-L32).  Using NO BORDER would be sensible if the PICKLIST was
  585. X      located at 1, 1 and was as big as the whole screen.
  586. X
  587. X    * Since the language is fully regular (I4GL-L09), all the strings can
  588. X      be replaced by character variables when required.  So, of course, can
  589. X      the attributes (I4GL-???).  The COMMENT and SELECTION sections are
  590. X      making use of the proposed string concatenation operation (I4GL-L31).
  591. X
  592. X    * The TITLE, COMMENT and LABELLED sections define the labelling for the
  593. X      PICKLIST.  The title (if any) appears on the window's title line,
  594. X      which defaults to FIRST.  The comment (if any) appears on the
  595. X      window's comment line.  The labels appear on the LABEL LINE, which
  596. X      defaults to TITLE LINE + 1, but would be specified using FIRST + n or
  597. X      LAST - n notatation.  Multi-part titles are supported because you can
  598. X      specify up to three parts to the title: LEFT TITLE "String1", CENTRE
  599. X      TITLE "String2", RIGHT TITLE "String3", with unadorned TITLE "String"
  600. X      being considered as CENTRE TITLE.  This would allow the date and
  601. X      version control information to be displayed as well as the main
  602. X      title, and would allow them to be displayed with different attributes
  603. X      (DIM in contrast to REVERSE, perhaps).
  604. X
  605. X      Oh, and it would be nice if the product supported both spellings of
  606. X      CENTRE and CENTER.  I4GL already does this with MAX and MAXIMUM, LINE
  607. X      and LINES, and in a number of other places, so one more wouldn't hurt
  608. X      either.
  609. X
  610. X    * The SELECTION section defines the data to be selected and the
  611. X      ordering of this data (if any).  The names specified in the
  612. X      DISPLAYING section are the display labels of the selected columns
  613. X      (remembering that T1.Col01 has a default display label of Col01).
  614. X      These names must be unambiguous (so it must meet the same constraints
  615. X      as would be required if the SELECT statement were to be used with an
  616. X      INTO TEMP clause).  The example uses a string to build the SELECT
  617. X      statement; this is certainly desirable.  It might also be desirable to
  618. X      allow a SELECT statement to be written out verbatim (not in a string),
  619. X      though the benefit is marginal given I4GL-L31.
  620. X
  621. X      Note that some of the selected data might not be displayed, and some
  622. X      of the returned data might not be displayed.  This would occur where
  623. X      a serial column is used internally to identify an object, but the
  624. X      user always identifies an object by a meaningful character string.
  625. X      Consider a scenario where there are two tables defining ports and
  626. X      countries.  The ports are internally referred to by Port_id, but the
  627. X      user always uses Port_name to identify the port.  Each port is in a
  628. X      country, identified by a country code.  The order in which the
  629. X      countries are listed is defined by an ordering indicator, and within
  630. X      a country, the order of the ports is defined by a second ordering
  631. X      indicator.  The user would only see the port name and country name,
  632. X      but the select statement would have to return Port_id, Port_name,
  633. X      Country_name, Country_order, Port_order; the data would be ordered on
  634. X      the last two columns, the first column would be returned to the
  635. X      program, and the other two columns would be displayed to the user.
  636. X
  637. X      The REGENERATE attribute indicates that the data must be reselected
  638. X      every time the PICKLIST is used.  If the SELECTION changes, the data
  639. X      would be regenerated automatically, of course.  It should be possible
  640. X      to declare WITHOUT REGENERATE (the default) as well as REGENERATE
  641. X      (I4GL-L32).
  642. X
  643. X    * The MAX SELECTED ROWS clause is used to indicate that only the first
  644. X      150 rows are to be used, even if the SELECT statement would return
  645. X      more.
  646. X
  647. X    * The AUTORETURN attribute means that if the SELECT statement returns a
  648. X      single row, the window is not displayed and the key is returned
  649. X      automatically, and if no rows are returned, then the returned key is
  650. X      all null.  The NO AUTORETURN attribute is the default.  If STATUS was
  651. X      set to NOTFOUND when zero rows were found and was set to 0 when one
  652. X      row was found), this would allow the two cases to be distinguished
  653. X      adequately.
  654. X
  655. X      Given that the SELECT statement is a string, it could use "?" place
  656. X      markers for variables, in which case the SELECTION clause would need
  657. X      a USING sub-clause which defined which variables were to be
  658. X      associated with which place markers.
  659. X
  660. X    * The DISPLAYING clause uses the display labels from the SELECTION to
  661. X      define which fields which will be shown on the form and the order in
  662. X      which they appear across the screen.  If there is a LABELLED clause,
  663. X      then the Nth column in the DISPLAYING clause will be labelled with
  664. X      the Nth string in the LABELLED clause.  It is an error if the number
  665. X      of fields in the LABELLED clause differs from the number of items in
  666. X      the DISPLAYING clause; if necessary, null labels must be supplied.
  667. X      It is another run-time error if any of the columns listed in the
  668. X      DISPLAYING clause is not produced by the SELECTION.
  669. X
  670. X      The fields will be sized automatically.  The WORDWRAP and TRUNCATED
  671. X      options could be combined (so that a VARCHAR(255) field could be
  672. X      truncated to 60 characters and wrapped in a width of 30), and other
  673. X      options are needed so that the format of the display rows can be
  674. X      defined precisely.  Additionally, each column should be able to have
  675. X      display attributes (primarily colour) if required.
  676. X
  677. X      If there is no DISPLAYING clause, then all the selected columns will
  678. X      be displayed in the order they appear in the selected data using
  679. X      default formats.
  680. X
  681. X      If the data layout defined or implied by the DISPLAYING section will
  682. X      not fit across the window defined in the window section, it is an
  683. X      run-time error.  The layout cannot be fixed at compile time because
  684. X      the actual data structure is not known until the SELECTION clause is
  685. X      evaluated at run-time.
  686. X
  687. X    * The PRIMARY KEY clause defines the columns to be returned, again
  688. X      using the display labels from the SELECTION.  Some thought needs to
  689. X      be given to the type of the columns listed in the PRIMARY KEY
  690. X      section, because the same values will have to be used elsewhere (see
  691. X      the section on multi-choice picklists below).  It is probably best if
  692. X      the names can be written either as literals which are converted to
  693. X      strings automatically or as a string expression.  It would be a
  694. X      compile-time error for two literals (be they literals or literal
  695. X      string expressions) to be identical.  It would be a run-time error
  696. X      for a string expression to evaluate to the same value as any of the
  697. X      other columns, but the code need only check this if one or more of
  698. X      the primary key columns is an expression.  It is another run-time
  699. X      error if any of the columns listed in the PRIMARY KEY clause is not
  700. X      produced by the SELECTION.
  701. X
  702. X    * The RETURNING clause terminates the statement when the user uses the
  703. X      KEY_SELECT (aka ACCEPT KEY?) to indicate their choice.  It defines
  704. X      the variables to receive the primary key values.  There must be as
  705. X      many variables as there are columns specified in the PRIMARY KEY
  706. X      clause, and the Nth variable in the RETURNING clause will be given
  707. X      the value from the Nth column in the PRIMARY KEY clause.  A
  708. X      multi-choice PICKLIST will not use this clause.
  709. X
  710. X    * If an error occurred while the window was being set up or the data
  711. X      was being selected, the appropriate error indicators (STATUS and
  712. X      possibly SQLCA) would be set as normal, and the statement would exit.
  713. X      The values of the returned variables would be undefined.  If an
  714. X      interrupt or quit signal occurred during a picklist operation, then
  715. X      INT_FLAG or QUIT_FLAG would be set and the statement would exit
  716. X      leaving the values of the returned variables undefined.
  717. X
  718. X    * Support for multi-choice picklists is provided by allowing the
  719. X      various BEFORE/AFTER/ON constructs in place of (or as well as) the
  720. X      RETURNING clause.  For example, an ON KEY (KEY_SELECT) clause could
  721. X      be used to store the primary key values of the current row somewhere
  722. X      where they could be got at after the PICKLIST was over.  This could
  723. X      be an array of values, or some set of functions which provided a
  724. X      container for a list of values.  There would need to be some way of
  725. X      getting at the current values, which is non-trivial given that the
  726. X      number and type of the values varies from picklist to picklist.  A
  727. X      function such as:
  728. X
  729. X        LET variable = GET_CURRENT_VALUE(Column1)
  730. X
  731. X      would be needed.  The argument to this function is either a column
  732. X      name from the PRIMARY KEY clause or a string expression which matches
  733. X      one of the columns names specified in the PRIMARY KEY clause.
  734. X
  735. X      The EXIT PICKLIST and CONTINUE PICKLIST keywords would be needed.
  736. X      For consistency, the BEFORE PICKLIST and AFTER PICKLIST sections
  737. X      should be allowed, though it is not immediately obvious what they
  738. X      would be used for.  Similarly, if BEFORE ROW and AFTER ROW are not
  739. X      provided, someone is bound to miss them sooner rather than later.
  740. X
  741. X      The RETURNING clause equates with:
  742. X
  743. X        ON KEY (KEY_SELECT)
  744. X            LET variable1 = GET_CURRENT_VALUE(Column1)
  745. X            LET variable2 = GET_CURRENT_VALUE(Column2)
  746. X            EXIT PICKLIST
  747. X
  748. X      The RETURNING clause is logically redundant because it can be
  749. X      replaced by an appropriate ON KEY (KEY_SELECT) clause, but it has the
  750. X      merit of being fully checkable (is the correct number of variables
  751. X      set?), whereas if the user omitted one of the fields from the ON KEY
  752. X      (KEY_SELECT) clause, the compiler could not know whether this was an
  753. X      oversight or intentional and would have to deem it intentional.  The
  754. X      END PICKLIST keyword could be added anyway, and other ON KEY clauses
  755. X      (and BEFORE/AFTER clauses) could be supported anyway.
  756. X
  757. X    * It would be useful to be able to mark the rows which have been chosen
  758. X      by the user in a multi-choice PICKLIST.  A syntax for this would have
  759. X      to be added.  One relatively neat solution would be to have the
  760. X      SELECT statement select a constant value (such as blank) as
  761. X      Column0, and then to have support for:
  762. X
  763. X        CALL SET_CURRENT_VALUE(Column0) = "X"
  764. X
  765. X    * Note that if the compiler's lexical analyser regards compound
  766. X      keywords such as END PICKLIST or TITLE LINE as a single symbol rather
  767. X      than as two symbols, then there is no ambiguity in the grammar above:
  768. X      the TITLE LINE attribute of the WINDOW clause cannot be confused with
  769. X      the TITLE clause.
  770. X
  771. X    * This statement is very much like the INPUT and INPUT ARRAY
  772. X      statements.  The minimal form of a PICKLIST is something like the
  773. X      example below, which is pretty compact, but as more demands are made
  774. X      on the appearance of the data and on the controls required over the
  775. X      user, the statement can get very complex indeed.
  776. X
  777. X        PICKLIST
  778. X            SELECTION "SELECT * FROM Simple_lookup"
  779. X            PRIMARY KEY Column01
  780. X            RETURNING variable01
  781. X        END PICKLIST
  782. X
  783. X----------------------------------------------------------------------
  784. X
  785. XGosh, you're still with me.  I wish I could guarantee that your persistence
  786. Xwould be rewarded, but I can't.  Anyway, I would like to receive your views
  787. Xon what has been said here, especially if you disagree with something, or
  788. Xif you think something is missing.  I will assume that if you say nothing
  789. Xabout some item, you do not violently disagree with it.  I will assume
  790. Xnothing about your response if you don't say anything.
  791. X
  792. XYou can email me at:
  793. Xjohnl@obelix.informix.com or ...!uunet!pyramid!infmx!johnl
  794. X
  795. X----------------------------------------------------------------------
  796. X
  797. XPrepared by: Jonathan Leffler, Informix Software UK.  January 1993.
  798. X@(#)i4glmods Version 1.6 Date 93/01/22
  799. SHAR_EOF
  800. echo "File i4glmods is complete"
  801. chmod 0444 i4glmods || echo "$0: failed to restore i4glmods"
  802. rm -f s2_seq_.tmp
  803. echo "You have unpacked the last part"
  804. echo All files extracted
  805. exit 0
  806.