Home
TeamSite
Find the last value in a Custom-table
Noble
Does anyone know a way to find the latest inserted value in a custom-table?
Preferably using the IMANAGE-API?
I tried to use the IManDatabase.SearchCustomAttributes but that is limited to the first 250 rows in the database,so that didn't work because there are more than 250 rows in the table
Find more posts tagged with
Comments
bfelknor
Is this a requirement from the clien are t application ? Are you trying to present the newest list items first ? If you
are working on an adminstrative application, perhaps you should look into the Server API ?
Noble
No.
I've created a method that works as a sequencer for matter ids
It retrieves the last value in the custom4- table, adds 1 and inserts the new value into custom4 using the InsertParentCustomField-method
The format of the is YY-99999, so if the last value in custom4 is 04-00345 then the next value will be 04-00346.
Therefore I need to find the last inserted value in the custom4-table
bfelknor
That's not going to work. If you have to make this available for every client pc, you could either post the data to another server and use client/server connection to get/update that data. Or, you could do something sneaky like posting the data to a WorkSite document, retrieve the document in your application, read the data and repost. Of course, that takes time. Alternatively, you could use the method just described to store the "current" range of new values in Custom4, read that once when WorkSite client starts and use the data to perform filtered searches on Custom4. That would allow you to limit your result set and find the current highest value. A process like that could become increasingly efficient during a session by using the last value selected on the client as the filter criteria for the next search: Custom4 > {mylastvalue}....
myanghua
I think what you can do is to use a SQL similar to the following:
select alias from custom4 order by alias desc
The first data row will have the latest record.
Hope this helps.