Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change the Text Value of a Compute Col. on DW?

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
0
0
US
I have a compute column on a datawindow in PB6.5. During run time I would like to change the text value of this column(in other words the expresion for the compute column). The expression will just be plain text. Its just a column that will display different text during run time. I've tried the dw.Modify() function but I must be using the wrong value for the Modify function.

What would the right syntax be to modify the expression attribute for a compute column during run time?

How could I do the same thing if I created a text object in the header of the datawindow and then change that during run time?

Keith
 
It is Computed-Field painted on the dw's layout. Computed-Columns are part of the SQL statement:

dw.Modify( &quot;<computed-field>.Expression = '<...>'&quot; )
dw.Object.<Computed-Field>.Expression = &quot;<...>&quot;

dw.Object.<Header-Text>.Text = &quot;<...>&quot;

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
I've tried the following syntax:

dw.modify(&quot;computedfieldname.expression='&quot; + ls_value + &quot;'&quot; + '&quot;')

When I run this and check the return value of the modify() function I get the following error:

Lin 1 Column 51: incorrect syntax

My computed object(field) is placed in the header band of the datawindow. What is wrong with the above syntax?

Thanks,

Keith
 
Instead of this:

dw.modify(&quot;computedfieldname.expression='&quot; + ls_value + &quot;'&quot; + '&quot;')

TRY THIS:

dw.modify(&quot;computedfieldname.expression='&quot; + ls_value + &quot;'&quot; )

Works for me...

---
PowerObject!


 
I tried this and it still doesn't work.

This is what I did. I have a dw where I use the toolbar button to select 'compute'. I point to the area of the datawindow where I want to put this compute object(in the header band). The 'computed object' dialog box appears. In the name field I type the name of the field to what I want. In the 'expression' field I put an empty string by typing to single quotes. I Then click the 'ok' button. I then save the datawindow. My code looks like:

ls_rtn = tabpage_1.dw_1.Modify(&quot;pap_class_type.expression='&quot; + ls_title + &quot;'&quot;)

I'm using PB6.5 and Sybase SQL Anywhere 8

ls_rtn still returns incorrect syntax. Anymore suggestions would be helpfull

 
FYI - I tried using a text object in the header band and used the following syntax you suggested in your first reply and it worked fine:

dw.Object.<Header-Text>.Text = &quot;<...>&quot;

For some reason it's not working with a computed object.

Thanks,

Keith
 
Make sure you are using the same NAME that you assigned to the computed-field in the Modify(). Is pap_class_type the name you assigned to your computed field?

Try: dw.Object.pap_class_type.Expression = ls_Title

Make sure that you are using the correct datawindow and there are no duplicate datawindow objects in other libraries that may be getting assigned to your datawindow control at runtime that may not have this computed-field (check your library-path).

Make sure you are targetting the right datawindow control (tabpage_1.dw_1).

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top