Find out column name in an expression.



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( '<ColumnName>.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


Question Tags: 


Kim Berghall answered Find out column name in an expression.


"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... 

Michael Kramer answered Find out column name in an expression.


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

Chris Pollach's picture

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

Michael Kramer's picture

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

markus.eckert_20938's picture

Thanks for this hidden gem!