1. Neil Sutter
  2. PowerBuilder
  3. Tuesday, 24 April 2018 14:44 PM UTC

Hi, 

Trying to determine how to get the width of a column in a grid dw if width.autosize = 3 (that is, width autosize is turned on. )

If height.autosize=yes, then you can call RowHeight() to get the actual adjusted height. Is there a comparable function or method for getting the column width after autosize has been applied? colxxx.width does not work as width.autosize does not adjust that parameter. 

TIA. 

Neil

Erick Bergsma Accepted Answer Pending Moderation
  1. Tuesday, 24 September 2024 15:58 PM UTC
  2. PowerBuilder
  3. # 1

Hello all...

Was there a solution found for this?

I am successful in setting the Width.Autosize value, but the data looks cramped, and the consumers of the report would like to add a little white space after each column.

When I use ls_retval = dw_name.Describe("#" + String( ll_Loop ) + ".Width") to get the (new) width, it is reporting the original width of the column, not the new adjusted width.

I've tried lots of variations using Evaluate, but can't seem to get the value of the width of the column.

I am using PB2022 R3.

 

 

Comment
There are no comments made yet.
Neil Sutter Accepted Answer Pending Moderation
  1. Tuesday, 24 April 2018 18:24 PM UTC
  2. PowerBuilder
  3. # 2

Thanks Chris, 

Unfortunately, Evaluate() isn't my strongest skill, assuming I have any (lol). 

Can anyone give me a head start on the format to get the width of a specified column using Evaluate? 

Among others, I have tried the following with no joy. Have tried with both row = 1 and row = 0, same result in all cases. 

// Generates "Column number is not valid" error
// Column 1 exists, so guessing that #1 is not a legal way to address it
ls_ModString = "Evaluate('#1.Width', 1)"
ls_Result = dw_detail.Describe (ls_ModString)
 
// Removed the # - error is "Expression is not valid"
ls_ModString = "Evaluate('1.Width', 1)"
ls_Result = dw_detail.Describe (ls_ModString)
 
// The name of column #1 in the dw is col0 - gives error "Expression is not valid"
ls_ModString = "Evaluate('col0.Width', 1)"
ls_Result = dw_detail.Describe (ls_ModString)
 
// Removed the quotes around the expression - no error, but also no result
ls_ModString = "Evaluate(col0.Width, 1)"
ls_Result = dw_detail.Describe (ls_ModString)
 
// Removed the quotes around the expression - no error, but also no result
ls_ModString = "Evaluate(#1.Width, 1)"
ls_Result = dw_detail.Describe (ls_ModString)

// Tried this thinking maybe .width was possibly a function in "datawindow language"
// Generates error "User function was not found"
ls_ModString = "Evaluate('Width(col0)', 1)"
ls_Result = dw_detail.Describe (ls_ModString)

 

What other formats yield the width of a column using Evaluate?

TIA

Neil

Comment
  1. Jean-Paul Legault
  2. Tuesday, 24 April 2018 19:24 PM UTC
I didn't have to use the evaluate function to getting the width. I turned autosize on and I just used the describe function below and it worked.



string ls_width 

ls_width = this.Describe("#1 .Width")

  1. Helpful 1
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 24 April 2018 14:48 PM UTC
  2. PowerBuilder
  3. # 3

Hi Neil;

    You would have to use the Evaluate ( ) method for that aspect.

Regards ... Chris

Comment
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.