ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Hide or display new column based on flag value

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

  • Hide or display new column based on flag value

    Hi There,

    I have a specific customer requirement in which they wanted to add new column to existing subfile screen.
    Egg.
    Opt Order No Cust No Comments
    __ 12345 999999 Dispatched
    __ 54321 888888 Error in consignee

    These are existing columns, now they wanted to add "Line No" column in between "Order No" & "Cust No" based on flag value. Say my flag value is 'Y' then "Line No" column should be displayed otherwise show as it is as above. So issue coming here is how to show new column in between when flag = "Y" else show as it is currently showing...!!!

    Please advice.
    Cheers...
    Nil

  • #2
    My first thought is to have two subfile record and subfile control record formats, one with the Line No field and one without. If the flag is Y, display the formats with the added field, else display the one without. The only changes needed to calcs would be to populate the extra field and determine which screen to display. What I am unclear is whether you can use the same subfile control record for each subfile record. That would be easy to test.

    Comment


    • #3
      After experimenting with this I'd delete or modify my previous comment if I could. There is more coding involved than I first thought, at least the way that I write subfile programs and the naming conventions that I use. Your results may vary.

      Comment


      • #4
        There are another possibility.
        Assuming that there are no fields that should be highlighted or marked with a color and all fields are output
        then you could define a character field that represents an entire subfile line. It could for example be 75 characters long if you are
        using 24x80 displays.

        In your program you define 2 data structures that matches the layout of one subfile line, one with the fields including the line number
        and one without the line number. The you take the data structure with the format you want to display and moves it into the 75 character
        field in the subfile. And now you can show the 2 formats of the subfile.
        If you save the contents of the 2 data structures in hidden fields in the subfile then you don't have to reload the entire subfile but only
        chain the subfile record, move the hidden field into the 75 char field and update the record.

        But it might be even simpler to have 2 subfiles as Taherte001 suggests.
        It depends on the structure of your program.


        Comment

        Working...
        X