Link to home
Start Free TrialLog in
Avatar of venkat4sv
venkat4sv

asked on

Column name validation

How do I get the column name, if I know the database name in Powerbuilder.  Below example shows the

Employee ID                   :         ______emp_id________
(col name : emp_id_t)                 (db name: emp_id)

If I give the col name then I'm getting the result,  but dynamically how do I get the col name.

ls_coltext = "emp_id_t"
ls_coltext = dw_1.Describe(ls_coltext + ".Text")   =====> Employee ID

Here the problem is how do we get the ls_coltext in dynamically and I need final result is: Employee ID
Thanks for your advance help.
Avatar of michaelstoffel
michaelstoffel

I'd say you're going about it the wrong way.  The UI should know less about the backend, not the reverse.  Also, there is not necessarily any direct correspondence between a label and a database field, or even a database field and a control painted on the window.  For example:

db column "columnA" has an edit control, but no label
db column "columnA" has 2 controls, a dddw and a non-editable display
db column "columnA isn't painted at all
db column "columnA" is datawindow column "my_column"

That being said, as long as a strict naming convention is followed, you can get all the attributes you need using Describe and loop through the controls on the datawindow looking for what you want (db column emp_id has a label with a name emp_id_t)  If those naming conventions aren't followed, you are out of luck.

Mike
ASKER CERTIFIED SOLUTION
Avatar of sandeep_patel
sandeep_patel
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of venkat4sv

ASKER

Hi Sandeep,
I agreee with PB autimatically created labels for each column and name of that label will be colname_t. But in my datawindow there are different labels(some are without _t and some are different from db name).  Is there any possible way to get label name if we have db name. I appreciate your help.
Thanks
Venkat.
Hi,

There is no direct association between label and column in PB. Either you have to rename the labels accordingly ( in specific pattern) OR create a table which contains datawindow + column + label and later you can select from table.

Regards,
Sandeep