Solved

Cannot change the name of a column in a datawindow

Posted on 2006-06-18
7
861 Views
Last Modified: 2013-12-26
Hi All!!

I am trying to change the name of a column, but it doesn't seem to work.

Here is the code:

dw_1.Modify("t1.text="+"BERGEN")
//dw_1.Modify("object.t1.Name="+"MORRIS")

Any help would be appreciated.

Thanks!!

PEM

0
Comment
Question by:pemurray
7 Comments
 
LVL 4

Expert Comment

by:batchakamal
ID: 16932150
To change the column name,


dw_1.object.t1.dbName = "New Name"
dw_1.setredraw(true)

to get the changed column name during the run time,

string st_name
st_name = dw_1.object.t1.dbName // Note that we use here also t1 not the "New Name"

Cheers!!!





0
 

Author Comment

by:pemurray
ID: 16934721
Greetings Kamaludeen,

I tried:

dw_1.object.t1.dbName = "MORRIS"
dw_1.setredraw(true)

and

dw_1.object.t1.Name = "MORRIS"
dw_1.setredraw(true)

Both times I received the following error message:

Error: Error accessing external object property dbname (or name when I changed it)
(Line 1 column 12: incorrect syntax)...and the line number in my code

Thank you,

Paul
0
 
LVL 4

Assisted Solution

by:batchakamal
batchakamal earned 165 total points
ID: 16940284
r u sure that "t1" is a name of the column?
before these lines, did u write ur setTransObject function?

make sure these two things and tell me.

By the way, which version of PB u r using??

Bye
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 18

Assisted Solution

by:diasroshan
diasroshan earned 170 total points
ID: 16957353
Hi,

see if this works for u...

dw_1.Modify("t1.text='BERGEN'")

ive removed the plus(+) sign and put BERGEN within single quotes...

lemme know if it worked...

Cheers,
Rosh
0
 
LVL 14

Accepted Solution

by:
sandeep_patel earned 165 total points
ID: 16959881
Hi,

Powerbuilder help says that for column you can change 'dbname' propert. But you can't change 'name' property

so if datawindow dw_1 has dataobject dw_emp which has column with name empid and dbname emp_code

you CAN write...

dw_1.Object.empid.dbname = 'empid' ( which will change emp_code to empid)

you CAN'T write

dw_1.Object.empid.name = 'emp_code' ( you can't change empid to emp_code)

I think it is clear...

Regards,
Sandeep

0
 

Author Comment

by:pemurray
ID: 16960513
Thanks Rosh and Sandeep,

Okay...

I tried this:

dw_1.Modify("t1.text='BERGEN'")

That works.

Of course I am have to do it programatically, so I have been trying this:

string dwmodreturncode

for i = 1 to countyarraylength
      
      dw_mod_string = '"Object.' + "t" + string(i) + ".Text=" +"'"+ countyarray[i] + "'" + '"'
      dwmodreturncode = dw_1.Modify("textcontrolname.Text='string'" )
      MESSAGEBOX("dwMOD",dw_mod_string + " " + dwmodreturncode)

next

When I run it, the message box displays:

               "Object.t1.Text = 'EWR'" Line 1 Column 21: incorrect syntax

Thanks again for your help!!

Paul
0
 

Author Comment

by:pemurray
ID: 16971034
I am closing this out and assigning the points the best way I could.

First, I did not ask the question right.  I should have stated from the beginning that I wanted to change the TEXT, the name and not the dbname.

Secondly, as far as I can tell, THIS CANNOT BE DONE WITH COMPUTED COLUMNS.

Using a suggestion from one of Bhatti's answers, I created an external datawindow in grid format and then I was able to very easily change the name of the text in the column.

Sybase, please take note of this problem.

Best to all and thanks for your help.

best,

Paul
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now