Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Cannot change the name of a column in a datawindow

Posted on 2006-06-18
7
Medium Priority
?
1,019 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
[X]
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
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 660 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Assisted Solution

by:diasroshan
diasroshan earned 680 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 660 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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. …
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 use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

610 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