Populate custom table primary key with Sage 200 key value (3 replies)
David, that's going to be difficult as I am not 100% confident how the IDs are maintained and generated.
However, when you run any insert where the insert requires an ID you get the following two statements per the screenshot.
It would appear that you need to somehow mimic Sage by generating a new ID, updating the Counter table (incrementing by 10), then writing into the actual table.
I thought a SQL function may be able to do this, but SQL doesn't allow user functions to update the database state.
Whilst a stored procedure would definitely achieve this, you wouldn't be get this to work with IMan.
The best I can offer is for you to update read and update the Counter table by a large enough amount and then for each record assign a value less than the value which has been updated to the Counter table.
Thank you for advising me.
The other idea that I had would be to develop a custom connector to write to the Sage 200 custom table. I already have code generated via the object store builder that is used by Sage 200 to write to the table and wondered if the custom connector can use the code as well.
A connector would seem a lot of work for a simple update.
I think the database approach is easiest.
I have a custom table that is written to by Sage 200. I also need to write to the table from IMan. How do i write to the table's primary key in IMan so that it doesn't clash with Sage 200 and cause a duplicate key error?