View previous topic :: View next topic
|
Author |
Message |
grvdeshmukh0
New User
Joined: 16 Jan 2020 Posts: 3 Location: Pune
|
|
|
|
Hi,
Currently, I am working on a REXX automation and facing difficulty while generating dynamic panel based on user’s input
I want to take the number of columns as an input from the user and then based on that, panel should generate that many input fields for the user to enter column names. Can anyone please suggest how can I achieve this |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
What is the difficulty? What have you achieved so far? |
|
Back to top |
|
|
grvdeshmukh0
New User
Joined: 16 Jan 2020 Posts: 3 Location: Pune
|
|
|
|
Hi .. I have been able to create static panels wherein a user can give fix number of inputs. But my requirement is a bit different. Please refer the below example.
Please Enter no of Columns: (To be entered by user)
Then the panel should display that many input fields for the column names so that user can enter further inputs |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You cannot change the layout of the currently displayed panel whilst it is being displayed. Get the information from the user then create a new panel with the requisite number of fields and display that. |
|
Back to top |
|
|
grvdeshmukh0
New User
Joined: 16 Jan 2020 Posts: 3 Location: Pune
|
|
|
|
Thanks for the input. Do you have any example or link which I can refer to? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
You could try this.
Create your panel with the maximum number of possible columns.
For my example lets say Nine.
Then in your INIT section, change the attributes for columns higher than the requested amount.
See an example here. Modify this for your needs.
Code: |
)INIT
IF (&COLREQ < 9)
.ATTR(COL9) = ' TYPE(OUTPUT) INTENS(NON)'
IF (&COLREQ < 8)
.ATTR(COL8) = ' TYPE(OUTPUT) INTENS(NON)'
IF (&COLREQ < 7)
.ATTR(COL7) = ' TYPE(OUTPUT) INTENS(NON)' |
|
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Use an ISPF table:
- Define a panel with a fixed part (Enter no of Columns:) and a )MODEL part.
- Define an ISPF table with fields: seq.no, column name and other info you need.
- Display (or TBDISPL) the panel and empty table.
- Once the user enters the no of Columns, create dummy entries in the table (with only seq. no)
- TBDISPL the panel and let the user fill the empty lines with column names and so on.
Another option would be to have a panel with a fixed part (column name and other info) and a )MODEL part.
Each time the user fills the fixed part and hits ENTER, a row is added to the ISPF table and displayed in the )MODEL part, and the fixed part is cleared. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Use REXX to generate the panel, write it to a temporary dataset and do a LIBDEF ISPPLIB to that dataset.
Alternatively build the panel in a REXX stem and use the ISPF panel exit ISPDPX01 found at harders-jensen.com/wjtech/zprograms.html to show the panel dynamically. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
The problem description is still not clear to me. Are you automating the creation of a DB2 table? If so, I recommend using the 'create' panels of IBM's DB2 Administration Tool. It already solves the problems you are likely to encounter. Many DB2 customers also have the DB2 Admin Tool.
If not DB2, then I agree with Marso's suggestion of using an ISPF table to get column information from the user. Though, my suggestion is for the table display to support line commands to repeat/delete/insert column information. |
|
Back to top |
|
|
Imabeliever
New User
Joined: 15 Aug 2019 Posts: 4 Location: Australia
|
|
|
|
You can create a dynamic area on a panel and put however many fields you like there (up to whatever documented limits there are).
You control the field contents programmatically. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Imabeliever wrote: |
You can create a dynamic area on a panel and put however many fields you like there (up to whatever documented limits there are).
You control the field contents programmatically. |
That's exactly what SDSF is doing. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
You can create a dynamic area on a panel |
I did that on a project when I worked for IBM. It was somewhat difficult, especially when you have to scroll. Also, you have to parse out any input fields that you create and verify them yourself.
When someone asked me for advice, I gave them this idea which they implemented:
1. ask the user for how many fields
2. allocate a PDS
3. from your program, create the panel in the new PDS. I assume the top has fixed area and the 'field' lines are repetitive (done in a loop)
4. LIBDEF ISPPLIB to the PDS
5. use DISPLAY service to show the panel. |
|
Back to top |
|
|
|