Question about reconnect process
Author: martinandheather@gmail.com (byjones)
Hello,
I have a table which consists of a primary key, and some other fields, one of which is a candidate key
e.g.
ID Numeric Primary Key
FORENAME String
SURNAME String
EMPLOYEECODE String Candidate Key
I have a webservice which updates this data from a 3rd party application. The ID field is not specified at all by the 3rd party application since they have no knowledge of it's value. Hence, only EMPLOYEECODE is common between the two systems. when calling this web service from the 3rd party app, the XML coming in is something like this
< EMPLOYEE status="new">
< ID.EMPLOYEE.MODEL>< /ID.EMPLOYEE.MODEL>
< FORENAME.EMPLOYEE.MODEL>Martin< /FORENAME.EMPLOYEE.MODEL>
< SURNAME.EMPLOYEE.MODEL>Jones< /SURNAME.EMPLOYEE.MODEL>
< EMPLOYEECODE.EMPLOYEE.MODEL>1234< /EMPLOYEECODE.EMPLOYEE.MODEL>
< /EMPLOYEE>
(spaces added so code display in this forum)
My code does xmlload XML, DTD:EMPLOYEE retrieve/reconnect if (ID="") get ID from system I am then able to create new records in the Employee table. I have also coded for the "mod" function, which modifies the database record. However, when calling this, I get an error that the record already exists in the database I have tried numerous things, including retrieve/e ENTITY to get the database record into my service prior to updating it. However, if I then pass in an employee id to update, and different data (e.g. changing the surname), it doesn't work.
Is anyone able to provide me with some examples of how to achieve creating, updating and deleting records using xmlload and retrieve/reconnect? It seems that if I do not specify the primary key in the XML, Uniface has a hard time reconnecting it to the database occurrence. I am using Uniface 9.3 on Windows
Thanks
Martin