Using Ice.SysSequence table

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?

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.

I would recommend you use User Codes to store sequences.

1 Like

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

Mark W.

3 Likes

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.

3 Likes

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?

1 Like

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:

2 Likes

image

3 Likes

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

1 Like