I have a web application where I want to update data in a table.
After the record ID is chosen, I populate an online webform with all the fields
So far so good
When the user clicks an update button I do an ajax callback where I get the updates from the form, open the table, find the record and do an update.
Simple enough and I have done this dozens of time before on other applications without problems
I now am generating type mismatch error on a field related to quantity.
The table has this field as a number
The dim qty as n = statement takes the form entry and using a val(data) makes it a number
when doing the update, I get the error.
Here is an excerpt of the code
function Save_SO_Updates as c (e as p)
'debug(1)
dim pn as c = e.rv.v.r1.Process_Number6
dim so as c = e.rv.v.r1.Sales_order4
dim sln as c = e.rv.v.r1.so_lot_num4
dim cc as c = e.rv.v.r1.customer_code
dim cn as c = e.rv.v.r1.customer_name
dim po as c = e.rv.v.r1.po_number
dim wip3 as c = e.rv.v.r1.wip5
dim cln as c = e.rv.v.r1.cust_lot_num
dim sm as c = e.rv.v.r1.starting_material
dim orderdue as c = e.rv.v.r1.due_date1
dim qty99 as n = val(e.rv.v.r1.Quantity) <---- This is the variable declaration involved
dim dddate as d = ctod(orderdue)
dim engrsup as c = e.rv.v.r1.engineering1
dim accmgr3 as c = e.rv.v.r1.account_mgr
dim priorty as c = e.rv.v.r1.priority
dim comments as c = e.rv.v.r1.OrderComments
dim trav as c = e.rv.v.r1.traveler2
dim ordup1 as p
'debug(1)
ordup1 = table.open("c:\noel_db\trvl_orderinfo.dbf",file_rw_shared)
query.filter = "Sales_Order ="+quote(so)+" .AND. So_Lot_Num ="+quote(sln)
query.order = ""
query.options = "I"
query.description = "Temporary Query"
i_indx = ordup1.query_create("N")
update.fields = 12
update.field1 = "Quantity"
update.expr1 = qty99
<--more update fields are following
The error is generated with the ordupd1.update() statement at the end
Error Message is:
Fatal error executing Ajax callback: Error executing Ajax callback. Error executing Ajax callback function 'SAVE_SO_UPDATES': command: ordup1.update() Type Mismatch: variable update.expr1 is of type Numeric variable, expected type Character.
Why does it expect a Character Value??
the table structure is:
Sales_Order Character 7 0
So_Lot_Num Character 2 0
Po_Number Character 30 0
Cust_Lot_Num Character 10 0
Due_Date Date 8 0
Customer_Code Character 8 0
Customer_Name Character 30 0
Account_Mgr Character 30 0
Traveler_Id Character 7 0
Starting_Material Character 30 0
Engineering Character 30 0
Priority Character 1 0
Beginningcomment Memo 10 0
Quantity Numeric 5 0
Anybody spot the problem? I have now spent over 3 hours on this and I thought it was working but then the error returned.
After the record ID is chosen, I populate an online webform with all the fields
So far so good
When the user clicks an update button I do an ajax callback where I get the updates from the form, open the table, find the record and do an update.
Simple enough and I have done this dozens of time before on other applications without problems
I now am generating type mismatch error on a field related to quantity.
The table has this field as a number
The dim qty as n = statement takes the form entry and using a val(data) makes it a number
when doing the update, I get the error.
Here is an excerpt of the code
function Save_SO_Updates as c (e as p)
'debug(1)
dim pn as c = e.rv.v.r1.Process_Number6
dim so as c = e.rv.v.r1.Sales_order4
dim sln as c = e.rv.v.r1.so_lot_num4
dim cc as c = e.rv.v.r1.customer_code
dim cn as c = e.rv.v.r1.customer_name
dim po as c = e.rv.v.r1.po_number
dim wip3 as c = e.rv.v.r1.wip5
dim cln as c = e.rv.v.r1.cust_lot_num
dim sm as c = e.rv.v.r1.starting_material
dim orderdue as c = e.rv.v.r1.due_date1
dim qty99 as n = val(e.rv.v.r1.Quantity) <---- This is the variable declaration involved
dim dddate as d = ctod(orderdue)
dim engrsup as c = e.rv.v.r1.engineering1
dim accmgr3 as c = e.rv.v.r1.account_mgr
dim priorty as c = e.rv.v.r1.priority
dim comments as c = e.rv.v.r1.OrderComments
dim trav as c = e.rv.v.r1.traveler2
dim ordup1 as p
'debug(1)
ordup1 = table.open("c:\noel_db\trvl_orderinfo.dbf",file_rw_shared)
query.filter = "Sales_Order ="+quote(so)+" .AND. So_Lot_Num ="+quote(sln)
query.order = ""
query.options = "I"
query.description = "Temporary Query"
i_indx = ordup1.query_create("N")
update.fields = 12
update.field1 = "Quantity"
update.expr1 = qty99
<--more update fields are following
The error is generated with the ordupd1.update() statement at the end
Error Message is:
Fatal error executing Ajax callback: Error executing Ajax callback. Error executing Ajax callback function 'SAVE_SO_UPDATES': command: ordup1.update() Type Mismatch: variable update.expr1 is of type Numeric variable, expected type Character.
Why does it expect a Character Value??
the table structure is:
Sales_Order Character 7 0
So_Lot_Num Character 2 0
Po_Number Character 30 0
Cust_Lot_Num Character 10 0
Due_Date Date 8 0
Customer_Code Character 8 0
Customer_Name Character 30 0
Account_Mgr Character 30 0
Traveler_Id Character 7 0
Starting_Material Character 30 0
Engineering Character 30 0
Priority Character 1 0
Beginningcomment Memo 10 0
Quantity Numeric 5 0
Anybody spot the problem? I have now spent over 3 hours on this and I thought it was working but then the error returned.
Comment