View previous topic :: View next topic
|
Author |
Message |
russnesbitt
New User
Joined: 08 Oct 2008 Posts: 5 Location: washington state
|
|
|
|
I have a panel that displays using a variable in the )MODEL statement. The value of the variable can change. I want to dynamically refresh the screen when requested by the user. This works sort of, it has to be executed twice for it to work. Here is a sample of my code. In my REXX program I set the variable &SHOWDT to "Y" or to "N", then I look at that to build the model line.
Code: |
)MODEL CLEAR(PGMOPT STATUS) ROWS(&MODTYPE)
&TBLLINE
)INIT
.HELP = PMSH01
&ZHTOP=PMSH01
.ZVARS =
'(ZSCBR PGMOPT PGMNAME, +
REL VER CSR SUBGRP USER LDATE LOC, +
STATUS LOCK MIGRATE)'
&LINEBASE = '@Z !Z !Z !Z !Z !Z $Z $Z $Z$Z $Z'
&LINEDTS = '$MODDT $MIGPOS$MIGCVC¬$Z¬'
&LINECMT = '!COMMENTS $Z¬'
VGET (SHOWDT) PROFILE
IF (&SHOWDT = 'Y')
&TBLLINE = '&LINEBASE.&LINEDTS'
ELSE
&TBLLINE = '&LINEBASE.&LINECMT'
VPUT (SHOWDT TBLLINE) PROFILE
)REINIT
VGET (SHOWDT) PROFILE
IF (&SHOWDT = 'Y')
&TBLLINE = '&LINEBASE.&LINEDTS'
ELSE
&TBLLINE = '&LINEBASE.&LINECMT'
VPUT (SHOWDT TBLLINE) PROFILE
REFRESH(TBLLINE)
)PROC
VGET (SHOWDT TBLLINE) PROFILE
)END
|
Any idea of why it has to be executed twice for it to work? |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Because of the way you use TBLLINE variable, I get the impression that you are not displaying a table!
I think panels with )MODEL sections are meant to be used with TBDISPL service (and in your program, also use TBCREATE, TBADD, etc...). I suspect without using table services, you get unpredictable results. |
|
Back to top |
|
|
russnesbitt
New User
Joined: 08 Oct 2008 Posts: 5 Location: washington state
|
|
|
|
No, I am using a table. The reason I am doing it this way is to simulate page right and left. When the customer wants to show different fields I change the value of "tblline". I was doing this in my REXX code and it was working fine, but I had to add some fields and it became kindof a pain to change all the places in the REXX code. So I am trying to do it all in the panel.
I think it should work. For testing I am showing the value of tblline on the panel and it gets changed correctly, but the table data does not change until the second time I redisplay the panel.
Here it is showing correctly (when I first come in)
Code: |
------------------------------- SHOWING COMMENT ------------------------------
COMMAND ==> Row 1 to 35 of 396
@Z !Z !Z !Z !Z !Z $Z $Z $Z$Z $Z!COMMENTS $
CHECKED L
PGM NAME REL VR CSR GRP USER OUT L STATUS K COMMENTS M
-- -------- ---- -- ------ --- ---- ------ - ------- - --------------------- -
__ ALI0415A 45X_ 00 R1218_ AUD 1218 200409 T _______ _ AUDIT________________ B
__ ALI200XA 60X_ 00 R5359_ ST9 5359 200703 T _______ _ SORT TAX DET PAYMENTS B
__ ALI200XD 60X_ 00 R5359_ ST9 5359 200703 T _______ _ NPI PHASE 3__________ B
|
Here is what it looks like after I try to change the display. If you look just below the command line you will see the value of tblline. It is correct. My titles changed but not the table data ...
Code: |
------------------------------- SHOWING DATES -----------------------------
COMMAND ==> Row 1 to 35 of 396
@Z !Z !Z !Z !Z !Z $Z $Z $Z$Z $Z$MODDT $MIGPOS$MIGCVC¬
CHECKED L LAST MIG MIG
PGM NAME REL VR CSR GRP USER OUT L STATUS K MOD DT TO POS TO CVC M
-- -------- ---- -- ------ --- ---- ------ - ------- - --------------------- -
__ ALI0415A 45X_ 00 R1218_ AUD 1218 200409 T _______ _ AUDIT________________ B
__ ALI200XA 60X_ 00 R5359_ ST9 5359 200703 T _______ _ SORT TAX DET PAYMENTS B
__ ALI200XD 60X_ 00 R5359_ ST9 5359 200703 T _______ _ NPI PHASE 3__________ B
|
And now here it is, displayed correctly after the second time ...
Code: |
------------------------------- SHOWING DATES ------------------------------
COMMAND ==> Row 1 to 35 of 396
@Z !Z !Z !Z !Z !Z $Z $Z $Z$Z $Z$MODDT $MIGPOS$MIGCVC¬$
CHECKED L LAST MIG MIG
PGM NAME REL VR CSR GRP USER OUT L STATUS K MOD DT TO POS TO CVC M
-- -------- ---- -- ------ --- ---- ------ - ------- - --------------------- -
__ ALI0415A 45X_ 00 R1218_ AUD 1218 200409 T _______ _ 200409 ______ ______ B
__ ALI200XA 60X_ 00 R5359_ ST9 5359 200703 T _______ _ 200703 ______ ______ B
|
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
You have some assignment statements in the )INIT section. Try putting the same assignment statements in the )REINIT section.
FYI. I think it is easier to have two separate panels and display the desired one as needed. |
|
Back to top |
|
|
russnesbitt
New User
Joined: 08 Oct 2008 Posts: 5 Location: washington state
|
|
|
|
Yes, I had already tried moving the assignment statments to the reinit section. I guess I will take a look at what it will take to create two seperate panels.
Thanks for your time. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
already tried moving |
I meant to have in both places.
Quote: |
what it will take to create two seperate panels |
Just copy the original, then edit both and remove the stuff that does not belong in that panel. Your application needs to display one panel or the other based on if LEFT or RIGHT was pressed. |
|
Back to top |
|
|
|