#Mysql server Sequence

Is there any way to trigger db sequence from expression rule , My requirement is like I will pass sequence name and the rule should return
next value of sequence , am using sql server.
My db script is:
 CREATE SEQUENCE [dbo].[testSequence2]
 AS [bigint]
 START WITH 5
 INCREMENT BY 2
 MINVALUE -9223372036854775808
 MAXVALUE 9223372036854775807
 CACHE
GO

  Discussion posts and replies are publicly visible

Parents
  • That maybe possible with some ninja-like trickery, but you might not want to do that using expression rule.

    In Appian, the number of times expression get evaluated is not guarantee. So if your rule created any side effects (triggered the DB sequence, in this case), you don't have full control of how many times the "side effect" will happen.

    "Side Effect" is defined as any changes in the system caused by the rule or function called, other than the returned value itself.

    docs.appian.com/.../Expressions.html

    To make changes such as triggering DB sequence, you should use one of DB Smart Services available. This should do it for you:

    docs.appian.com/.../Query_Database_Smart_Service.html
  • 0
    Certified Lead Developer
    in reply to rawich
    Can you elaborate on your use case, specifically why an expression rule?
    In my experience, sequences are not an informative piece of info to end users until something is created. For example, help desk ticket submitted gets a number or contract created gets a sequence plus locale. In these cases, I will generally either use the write to ds (and store the output) to get the id and email or present it to user. If I just need a sequence, not a generated value in insert to a table I use query rdbms node ore even stored proc plugin.
    Will that work for you?
Reply
  • 0
    Certified Lead Developer
    in reply to rawich
    Can you elaborate on your use case, specifically why an expression rule?
    In my experience, sequences are not an informative piece of info to end users until something is created. For example, help desk ticket submitted gets a number or contract created gets a sequence plus locale. In these cases, I will generally either use the write to ds (and store the output) to get the id and email or present it to user. If I just need a sequence, not a generated value in insert to a table I use query rdbms node ore even stored proc plugin.
    Will that work for you?
Children