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
2 Comments
Local Administrator
Martin, for the "mod" have you tried calling a service to get the appropriate ID in the Post-Load Occurrence trigger?
Also, we found the retrieve/reconnect is rather picky over the presence of the id attribute, but even an empty value helps to sort it out.
eg. < EMPLOYEE id="" status="new">
Andy
Author: heydona (andyh@collegenet.com)
Local Administrator
The Reconnect Process for Modified Occurrences part of the manual implies that retrieve/reconnect is only of any use if you have a primary key.
So, if you don't have a disconnected occ id or primary key, retrieve/reconnect won't find it.
You might be able to reference it if you look up the ID in post load occurrence as mentioned above.
Author: Iain Sharp (i.sharp@pcisystems.co.uk)