ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Control column heading on multi-column sub-file.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Control column heading on multi-column sub-file.

    Hi,
    I have a load-all sub-file that holds 30 records per page in two columns. I need to control the headings for column #2 so if there is 15 or less records displayed, column #2 headings do not show. This I have accomplished and works well when there is only 1 page with 15 or less records or, a full page with 30 records. If there are 45 records, page 2 shows 15 records in column #1 with a header and the header for column #2 is shown but there aren't any records in that column.

    This is my problem, how do I control the heading for column #2 when there is more than one page?

    Mike.
    Everyday's a school day, what grade are you in?

  • #2
    Usually with a subfile, you load all the records at once and the the system itself handles page up/down without having to return control to your program. Because fo that, I don't think you can control the non-subfile parts of the page depending on the number of records in the current subfile page.

    What you would have to do is use a "Page at a Time" subfile. This is where you only load one page's worth of records into the subfile, and control loading new records at page up/down yourself. Because your program is handing each page up/down, you can update the column headings at the same time.

    It's been along time since I had to code a subfile, but I think this is the basics of what you need
    In the DDS Subfile Control record, you would need keywords:
    • SFLPAG(30) - 30 records per page
    • SFLSIZ(31) - max subfile records is max per page + 1
    • ROLLUP(xx) - indicator xx is set on when Page Down is pressed
    • ROLLDOWN(yy) - indicator yy is set on when Page Up is pressed
    In your program, you would load only the first 30 records, set the column headings as needed, and display the subfile
    If the user hits Page Down, control will return to your program and indicator xx will be set on. Your program should now clear the subfile, write the next 30 records to it, set the column headings as needed, and display the subfile.
    The tricky part is if the user now hits Page Up. Control will return to your program with indicator yy set on. Your program now needs to clear the subfile, load the 30 records that were prior to the previous records, set the column headings as needed, and display the subfile. You will need to keep track of the first/last records on a particular page, so you can fetch the previous/next 30 as required.

    Comment


    • #3
      Now that is a great answer. Not only what to do but how.....
      Awesome response, mush appreciated Vectorspace.

      Thank you very much.
      Everyday's a school day, what grade are you in?

      Comment

      Working...
      X