Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Cannot change the name of a column in a datawindow

Posted on 2006-06-18
7
918 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

856 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