1. Gibi Varkey
  2. PowerBuilder
  3. Monday, 11 April 2022 04:04 AM UTC

Good Morning, Powerbuilder 2021 - How to dynamically hide / show  columns in between (other columns)  in a parameterized tabular datawindow ?

we need to automatically adjust the spaces on runtime if any columns are not visible and vice versa

John Fauss Accepted Answer Pending Moderation
  1. Monday, 11 April 2022 05:21 AM UTC
  2. PowerBuilder
  3. # 1

I'm hesitant to even attempt to answer such a wide-open, generalized question that could have many interpretations. Can you be a little more specific and include some screen shots (even mock-ups) of what you are wanting to accomplish and a more detailed description of the conditions under which data columns (and column heading, also?) would be hidden/shown?

To start with, I suggest you read in detail the following section in the PB 2021 DataWindow Programmers Guide titled "Dynamically Changing DataWindow Objects".

https://docs.appeon.com/pb2021/datawindow_programmers_guide/ch01s03.html

 

Comment
There are no comments made yet.
Gibi Varkey Accepted Answer Pending Moderation
  1. Monday, 11 April 2022 05:47 AM UTC
  2. PowerBuilder
  3. # 2

Thanks for your immediate response.. I have an existing datawindow as shown above. When i retrieve Jobs ( Jobs are principal specific ) , i need to show few more additional columns after product code, example barcode, color , size . But these fields are only for the selected principal, if i chose another principal and job these fields should not be visible. Means when i am setting visible property to 0 (for columns/header) for a specific principal, the hidden fields space should get adjusted automatically and adjacent fields should move over to hidden space. Hope it is more clear.

Comment
  1. mike S
  2. Monday, 11 April 2022 12:47 PM UTC
you code that yourself. use modify to set the x values.
  1. Helpful
  1. John Fauss
  2. Monday, 11 April 2022 13:54 PM UTC
...and modify/set the value of the Visible property for the affected column(s) and text (heading) DWObject(s).
  1. Helpful
  1. Brad Mettee
  2. Monday, 11 April 2022 15:02 PM UTC
Something like this on the X position properties of all the columns to the right of the invisible ones



if(isVisible=1, {VisXPosition}, {InvisXPosition})



you can also do something like this

{InvisXPosition} + ({InvisColWidth} * IsVisible)



Or, using what John suggests, set the TAG property of each object you need to move ("Need2Move"), then at runtime, loop through all of the objects on the DW and add the width of the invisible columns to their X position for each object with the tag when you're opening the window.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 11 April 2022 17:10 PM UTC
  2. PowerBuilder
  3. # 3

Hi Gibi;

  Suggestion: Instead of using a Tabular DWO style, I would suggest using a Grid styled DWO. When you hide/show (visible/invisible) a column(s) using the Modiy() command - the Grid DWO's columns should expand & contract automatically. Thus, allowing the columns to the right of the targeted column to either slide left or expand to the right as required (auto-magically).  Food for thought.

HTH

Regards ... Chris

Comment
  1. Gibi Varkey
  2. Wednesday, 13 April 2022 03:13 AM UTC
Thanks Chris, Grid style is fine. We used it. Thought to check any such option is available for Tabular style dw. Because it is heavily used object and lot of coding into it. Can you please tell us, if we change the existing tabular dw to grid style, what all we have to consider? Whether any impact on existing behaviour? any existing code has to change?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 13 April 2022 15:35 PM UTC
Hi Gibi ... The Grid DWO is basically another version of the tabular style. You can even turn off the Grid Line Display so that to the App user it still looks like a Tabular DWO. The challenge with the Tabular DWO type when hiding & showing column(s), is that it's a lot of PowerScript work to move (shift) other columns left/right vs the Grid DWO that will do all that column moving (heavy lifting) automatically.

As far as the Tabular => Grid transformation - your can do this in the DWO's source code by changing the "Processing=?" setting. However, you will still need to unit test to ensure functional compatibility (GUI) has not been compromised.

Regards ... Chris
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.