I came across an interesting problem that hopefully someone can shed some light on. I use code generated by Alpha genies whenever possible. Below is Alpha generated code that I placed on a web page.
This code is used to update a date field that is derived from a web dialog. The web dialog data is pulled from a table. I tried to replace the value in update.expr1 with the name of the dialog variable that contains the selected date(from a dropdown box). I also tried using CTOD(weekendingdate) put to no avail. The table would not update. If I hard code the data that follows update.expr1 it works.
I am assuming there is a problem with how the variable is passed as an expression for the update operation. In the meantime I have substituted an Xbasic routine that opens the table, loops through and makes the table change as needed. Thanks for any insight.
Steve
a_tbl = table.open("jfkstaff_final")
ON ERROR GOTO ERROR31032005103723051
DIM a5_operation_order as C
a5_operation_order = ""
query.order = a5_operation_order
DIM a5_operation_filter as C
a5_operation_filter = ".T."
query.filter = a5_operation_filter
query.options = "I"
query.description = "Temporary Query"
i_indx = a_tbl.query_create("N")
update.fields = 1
update.field1 = "MASTER_DATE"
update.expr1 = CTOD(weekendingdate)
a_tbl.update()
GOTO CONTINUE31032005103723051
ERROR31032005103723051:
ON ERROR GOTO 0
ui_msg_box("Error","Error running Update Operation"+crlf()+error_text_get())
END
CONTINUE31032005103723051:
a_tbl.close()'If the Operation is run from within a Form or Browse, then refresh the window
if is_object(topparent.this) then
if topparent.Class() = "form" .or. topparent.class() = "browse" then
topparent.Refresh_layout()
end if
end if
This code is used to update a date field that is derived from a web dialog. The web dialog data is pulled from a table. I tried to replace the value in update.expr1 with the name of the dialog variable that contains the selected date(from a dropdown box). I also tried using CTOD(weekendingdate) put to no avail. The table would not update. If I hard code the data that follows update.expr1 it works.
I am assuming there is a problem with how the variable is passed as an expression for the update operation. In the meantime I have substituted an Xbasic routine that opens the table, loops through and makes the table change as needed. Thanks for any insight.
Steve
a_tbl = table.open("jfkstaff_final")
ON ERROR GOTO ERROR31032005103723051
DIM a5_operation_order as C
a5_operation_order = ""
query.order = a5_operation_order
DIM a5_operation_filter as C
a5_operation_filter = ".T."
query.filter = a5_operation_filter
query.options = "I"
query.description = "Temporary Query"
i_indx = a_tbl.query_create("N")
update.fields = 1
update.field1 = "MASTER_DATE"
update.expr1 = CTOD(weekendingdate)
a_tbl.update()
GOTO CONTINUE31032005103723051
ERROR31032005103723051:
ON ERROR GOTO 0
ui_msg_box("Error","Error running Update Operation"+crlf()+error_text_get())
END
CONTINUE31032005103723051:
a_tbl.close()'If the Operation is run from within a Form or Browse, then refresh the window
if is_object(topparent.this) then
if topparent.Class() = "form" .or. topparent.class() = "browse" then
topparent.Refresh_layout()
end if
end if
Comment