Maximo Open Forum

 View Only
  • 1.  Missing Transactions

    Posted 03-01-2023 06:01

    Hello Everyone, 

    The automations script is getting the next transaction by selecting the maximum transaction id from interface table.  So when we receive a new transaction prior to the completion of the previous transaction, the same transaction id can be assigned to multiple transactions.

    We are trying to use an oracle sequence instead.  The sequence would be updated immediately instead of when the transaction is saved.

    I have created the sequence and register the sequence to Maximo.  Once the sequence has been created the automation script will need to be updated to select the next value from sequence instead of selecting maximum transaction id from the interface table.


    Here comes my question. how can we write this using automation script, To select the next value from sequence.

    Can anyone help on this. Thanks in Advance


    #Integrations

    ------------------------------
    Ishwarya Soundarya
    Accenture
    ------------------------------


  • 2.  RE: Missing Transactions

    Posted 03-01-2023 09:45
    conKey = ''
    connect = ''
    state = ''

    try:
    conKey = mbo.getThisMboSet().getUserInfo().getConnectionKey();
    connect = mbo.getThisMboSet().getMboServer().getDBConnection(conKey)
    state = con.createStatement()
    rs = state.execute("Select SQUENCENAME.NEXTVAL from DUAL")
    count=rs.getInt(1)
    #use Count as per your need.
    con.commit()
    finally:
    if state != "":
    state.close()
    if conKey != "" and connect != "":
    mbo.getThisMboSet().getMboServer().freeDBConnection(conKey)


    ------------------------------
    Prashant Sharma
    Sedin Technologies
    Connect with me @ https://www.linkedin.com/in/psharmamaximo/

    #IBM Champion 2022
    #IBM Champion 2023
    ------------------------------



  • 3.  RE: Missing Transactions

    Posted 03-06-2023 10:36

    Hi Prashant, 

    Thanks for your reply. I have tried using the above automation script which you given, its not working for my requirement.

    I created the sequence with minimum value 1, maximum value 9999999999 and increment by 1 with cache size 20, no order no cycle. But the count of nextvalue for the sequence is not getting incremented, it remains the same.

    I have also tried this, transid = sequence_name.nextvalue() and


    AND Also this,

        state = con.prepareStatement("select sequence_name.nextval as maxsequence from dual")
        trans = state.executeQuery()
        if (trans.next()):
            transid=trans.getInt("maxsequence")
        trans.close()
        state.close()

    But they are not working as expected.
    Can you please help me on this, what am i missing?

    Thanks in Advance



    ------------------------------
    Ishwarya Soundarya
    Accenture
    ------------------------------



  • 4.  RE: Missing Transactions

    Posted 03-02-2023 10:55

    It's not quite clear what you're trying to do.  Are you working with a custom object and trying to populate a unique ID attribute on it?  If so, all you need to do is associate a Sequence with that attribute and out-of-the-box logic in the MBO add() method will populate that attribute with the NEXTVAL for that Sequence.



    ------------------------------
    Julio Hernandez
    Ergonare, Inc.
    ------------------------------



  • 5.  RE: Missing Transactions

    Posted 03-07-2023 02:47

    Hi Julio, Thanks for your reply.

    I added a new post yesterday, please have a look. Also, can you please explain a bit more in detail, how to use in automation script.

    Thanks in Advance



    ------------------------------
    Ishwarya Soundarya
    Accenture
    ------------------------------



  • 6.  RE: Missing Transactions

    Posted 03-07-2023 10:40

    Hello Everyone, 

    Can anyone help on this.

    Thanks in Advance



    ------------------------------
    Ishwarya Soundarya
    Accenture
    ------------------------------



  • 7.  RE: Missing Transactions

    Posted 03-07-2023 12:37

    Hi.

    I didn't see your new post.  I don''t work with Automation Scripts (my clients use TRM's RulesManager) so I can't help you with that.  Did you try associating a Sequence with that attribute and letting the out-of-the-box logic handle it?



    ------------------------------
    Julio Hernandez
    Ergonare, Inc.
    ------------------------------