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!

DWC.Modify() - Error??? 1

Status
Not open for further replies.

bentleygt

Programmer
Feb 24, 2004
16
0
0
US
I'm trying to modify a computed field during runtime and I'm always getting an error when the Modify function is executed. Here is my code:

ls_mod_string = "c_field_name.Expression='" &
+ ls_value &
+ "'"

ls_err=dwc.Modify(ls_mod_string)

Why am I receiving an error? Am I missing a quote or something else?
 
check if your's computed field name is really "c_field_name
 
I checked to make sure this is the name and I have the correct name in my code.

Any more suggestions?

Thanks!
 
It could be because the expression in ls_value is invalid or contains quotes that conflict with the quotes surrounding the expression in ls_mod_string. Can you give an example of the expression you are trying to set and what is returned in ls_err?
 
ls_value is a local string variable. Here is the code:

ls_value="month one"

ls_mod_string during runtime is equal to:
c_field_name.Expression='month one'

ls_err during runtime is:

Line 1 Column 44: incorrect syntax.

 
You need to put an extra set of quotes around the text in ls_value because the "expression" you are trying to set is a literal string. Try setting ls_mod_string as follows:

ls_mod_string = "c_field_name.Expression=~"'" &
+ ls_value &
+ "'~""

 
This last post corrected the problem. Thank you very much for all those suggestions.

However, I'm experiencing a new issue. This code is actually for a Rich Text DW(don't know if this matters or not, but I thought I would mention it). The modify() is done for each row after the DW is retrieved. The first row for some odd reason does not display the value( value of ls_value after the modify() ). But all other rows, 2 through x, displays the value OK. Why would it work for all other rows, but not the first row? All my code for this exists in a user object function, not in any of the DW scripts/events.

How my DW displays each row:
I have a button on the window which performs getting/displaying the first, last, next and previous rows. So, my DW does not display all the rows retrieved to the user all at once. I'm using PB6.5 . I've tried using accepttext() after each modify in my loop for going through all the rows. This does not seen to help. I'm not getting any DW errors on the first row. So, I'm confused at this point why this is happening.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top