Using Ice.SysSequence table


(Matthew O'Haire) #1

How does one go about creating a custom sequence using the Ice.SysSequence table? Do I simply add a row with a new unique Name (e.g. ‘MyCustomSequence’) and start using it, or is there a UI somewhere that I should be using to setup the new sequence?


(Jose C Gomez) #2

That table isn’t made for you to manually create sequences in there is no UI for it and you shouldn’t manually insert records into Epicor Tables. If you want to keep your own sequence I recommand a Custom UD field on another table that you can control via UI.


(Dan Edwards) #3

I would recommend you use User Codes to store sequences.


(Mark Wonsil) #4

Remember to have a locking strategy so two users cannot get the same sequence number…

Mark W.


(Bart Elia) #5

If you need low level sequences in C# - the wrapper class for Ice.SysSequence is the Ice.Lib.NextValue assembly. That’s what we use internally.


(Matthew O'Haire) #6

Hi Bart, I also noticed the stored procedure Ice.GetNextSequence which will get the next (block) of numbers and even initialise the sequence (insert) if it’s not there. Is it OK to use this?


(Bart Elia) #7

Only if you want to get the app server out of sync with the db especially if have other app servers in a cluster (HINT - No you don’t).

As with all DB direct efforts, you run up against the fact we cache a lot of data in app server memory. When an update occurs, we intercept that and invalidate the cache (and distribute notifications to other app server boxes on data change too).

99% of the time going directly at the db is a bad idea. Even if you get away with it today, what happens in the next release when we add a performance improvement that adds a cache - then your effort gets stomped on and we get blamed for an improvement - Theoretically of course because that would never happen in real life :wink:

Sorry if exposing some past scars and war wounds - internal and external. Please don’t access the db :slight_smile:


(Jose C Gomez) #8

image


(Matthew O'Haire) #9

Thanks everyone for the feedback and guidance - heard loud an clear. I’ll use a User Code or Custom UD field. Thank you!