Hi,
in preperation for a case study next week I'm trying to program basic functions for use on a table. The table itself is basic and only created for this exercise.
It has (Keyfield) SERIAL (Namefield) NAME LNAME.
The display and the panel are working and produce the following output:
Now, the _ field should be used to input a letter to add, update or delete certain lines (one line at a time). For testing purposes, it is currently just 'x' that should initiate a second panel. The problems start here, so I'll provide you with the code that I have:
000100 /* REXX */
000110 address ispexec
000301 "TBOPEN TESTTBL NOWRITE"
000304 ZTDMARK = ' |----------------------------------------------|'
000305 "TBDISPL TESTTBL PANEL(VCT@TABL) POSITION(TESTP)"
000307 "TBCLOSE TESTTBL"
000400 exit
The REXX code to open my first panel. It will open my TESTTBL, change the BOTTOM OF DATA mark, display all the lines and write the position of the last selected row into TESTP, then close the table.
)ATTR
# TYPE(INPUT) color(turq) hilite(uscore)
§ TYPE(OUTPUT) color(turq)
)BODY EXPAND ({})
+{-} BROWSE COURSES {-}+
+==>#ZCMD+
+ | Course Nr. | Worktitle | English Title |
+ |--------------|-------------|-----------------|
)MODEL
#Z+| §SERIAL +| §NAME +| §LNAME +| +
)INIT
.ZVARS = INPUT
&INPUT = ' '
.cursor = INPUT
)PROC
ver(&INPUT,list x,' ')
&zsel = trans(&INPUT 'x','cmd(VCT@TAB2)',
' ',' ',
*,'?')
)END
This will create the panel and a scrollable area for my rows. Now, the panel will not change to VCT@TAB2, even if I type in 'x'. I think the problem is that e will somehow concatenate all the INPUTs that he has, so there is never only 1 'x' seen by the trans(). The PTEST will be the last selected row though, so if I type in 'x' somewhere, he will save the correct line position.
Now, this could be pretty easily solved using REXX and just checking each, then hardcoded variable, for the first occurance of 'x'. The problem is that I can't do that because my length is not solid.
My second problem lies within my VCT@TAB2 panel, as he will not display the selected row.
REXX
address ispexec
"VGET TESTP SHARED"
"TBOPEN TESTTBL WRITE"
"TBGET TESTTBL POSITION(TESTP)"
"DISPLAY PANEL(VCT@tab2)"
"TBCLOSE TESTTBL"
exit
This gets my TESTP, the position of the row last selected, opens my table in write mode (because, at a later stage of the project, I want to be able to change the data displayed), he gets the row from TESTP and displays my panel. Now, if I call the panel individually, it will display the structure of the table, but not the data of the row fetched. The panel itself is pretty simple:
)ATTR
# TYPE(INPUT) color(turq) hilite(uscore)
§ TYPE(INPUT) color(turq)
)BODY EXPAND ({})
+{-} Details {-}+
+==>#ZCMD+
+ | Course Nr. | Worktitle | English Title |
+ |--------------|-------------|-----------------|
+ | §SERIAL +| §NAME +| §LNAME +| +
)INIT
.cursor = ZCMD
)END
As I do not have a )MODEL statement, i can't use TBDISPL. The question would be if I need some sort of other display method for the one row I fetched, or if my whole attempt is wrong.
Thank you very much,
Florian