Solved

Cannot change the name of a column in a datawindow

Posted on 2006-06-18
7
909 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Refresh JTable Content 6 207
how to debug aspx file, how to debug javascript from visual studio? 12 165
error when i compile 5 624
Eclipse Neon start with Admin account only 6 119
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…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

813 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

10 Experts available now in Live!

Get 1:1 Help Now