Skip to main content
Question

Create Custom Field Sequence which re-set for new document

  • January 11, 2021
  • 4 replies
  • 269 views

Forum|alt.badge.img+1

I have scenario were the I want to generate sequence number based transaction i.e when when adding the line to PR sequence number to be generated automatically and for other PR sequence should again start from 1 again

This topic has been closed for comments

4 replies

  • Superhero (Employee)
  • 1429 replies
  • January 12, 2021
GLGMSHAMSTM wrote:

I have scenario were the I want to generate sequence number based transaction i.e when when adding the line to PR sequence number to be generated automatically and for other PR sequence should again start from 1 again

Don’t think you’ll be able to achieve this with config, rather you’d have to do this as a modification. 


Forum|alt.badge.img+7
  • Hero (Partner)
  • 48 replies
  • January 12, 2021

Hi There 

I have achieved something similar to this before but it isn’t possible with just customisations, you will need access to the database and have the access to create a custom sequence and trigger. 

Regards

Lee


Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • 4 replies
  • January 17, 2021

Hi WyrLeelew,

 

Can you please give the step and also please let me know whether end user also needs to have the access.


Forum|alt.badge.img+7
  • Hero (Partner)
  • 48 replies
  • January 18, 2021

Hi @GLGMSHAMSTM 

You will need IFSAPP level access to create the Sequence and Trigger in the IFS Database. 

Sequence Code

create sequence <Specify Sequence Name Here>minvalue 200000maxvalue 9999999999999999999999999999start with 200000increment by 1nocache;

Trigger

CREATE OR REPLACE TRIGGER <Trigger Name Here> BEFORE INSERT OR UPDATE ON <Table Name Here> FOR EACH ROWBEGIN  IF INSERTING THEN    :NEW.<Field Name> := IFSAPP.<Sequence Name>.NextVal;  END IF;

This should get you part way to your goal but you don’t get a number reset. 

Another option could be to use the Default Value functionality for the custom field and create an expression that looks for a previous line and increments the value by 1 or defaults to 1 if its the first line.

I hope this is helpful

Regards

Lee

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings