Solved

Cannot change the name of a column in a datawindow

Posted on 2006-06-18
7
836 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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. …
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

708 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

16 Experts available now in Live!

Get 1:1 Help Now