1. Markus Eckert
  2. PowerBuilder
  3. Friday, 13 April 2018 12:53 PM UTC

Hi

Is there any way to have an expression in a Datawindow refer to itself by name (or column number)?

For example if I want to have editable columns be underlined, I could use this code in its border expression.
if( long( describe( '.TabSequence' ) ) > 0, 4, 0 )

But if I want to apply this to several columns, I'll have to manually adapt that expression for every column.

So now my lazy inner voice is wondering if there's any way to get something like this to work?

Thanks in advance

Markus

Accepted Answer
Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 13 April 2018 14:37 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Markus,

I added this Border expression to every column in my DataWindow. Now, all TabOrder = 0 has 3DRaised, all others have 3DLowered.

if( Describe("#@col" + ".TabSequence") = '0', 6, 5)

HTH /Michael

Comment
  1. Chris Pollach @Appeon
  2. Friday, 13 April 2018 15:19 PM UTC
Hi Michael;



  You are correct .. the @COL will work within a Describe!



Note that you do not need the # sign ...





if( Describe("@col" + ".TabSequence") = '0', 6, 5)





Regards ... Chris

  1. Helpful
  1. Michael Kramer
  2. Friday, 13 April 2018 16:10 PM UTC
Thanks Chris,



Old habits die hard ;-)



The # prefix comes from converting column numbers into names outside the DW engine using Describe("#" + string(i) + ".name"). I simply kept using it inside the DW engine because it worked. Never thought of skipping it. But now I know!



Cheers, /Michael

  1. Helpful
  1. Markus Eckert
  2. Monday, 16 April 2018 07:05 AM UTC
Thanks for this hidden gem!

  1. Helpful
There are no comments made yet.
Kim Berghall Accepted Answer Pending Moderation
  1. Friday, 13 April 2018 13:31 PM UTC
  2. PowerBuilder
  3. # 1

"There are many ways to skin a cat", It seems beneficial to put this in the object (datawindow), but instead you might consider placing the code outside the dw. In our case we use PFC so it is super easy to put a few lines of code in one object and then all of the datawindows in the whole application are automatically covered. We underline the labels of columns with required fields. We use a different background color on datawindow columns that cannot be edited. You might consider that as well, to use the tab order value... 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 13 April 2018 13:47 PM UTC
  2. PowerBuilder
  3. # 2

Hi Markus;

  In other areas of the DW Object, the value @COL identifier works much like the PowerScript pronoun THIS. Unfortunately in this area you are inquiring about, the @COL is not applicable.

Regards ... Chris

Comment
  1. Glenn Barber
  2. Tuesday, 8 September 2020 23:46 PM UTC
You are correct



I tried IF( gf_getmodifiedstatus ( getrow(), integer(Describe("@Col"))) = 1, RGB(162,220,249), 1090519039) but it does not produce the expected results.
  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.