Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Last Insert ID

  • Last Insert ID

    Posted by Coralie on April 10, 2019 at 4:19 pm

    Hi everyone,
    I’m using Omnis 8 and a DataGrid within a Js Remote form.
    I’m having a bit of an issue to fetch back the last inserted Id.
    Do iSqlRow.$insert() Returns lReturnFlag
    If lReturnFlag
    Calculate iOldRow as iSqlRow
    End If
    Do iChildList.$dowork() Returns lFlag
    If not(lFlag)
    Do method showLastError (lStatRef)
    Else
    OK message OK {Enregistré avec succès.}
    End If
    Do $sessions.SV.$newstatement() Returns StatementObj
    Do StatementObj.$prepare(‘UPDATE TableA SET TableA_Fk = (SELECT TableB_Id FROM TableB)’) Returns #F
    Do StatementObj.$execute() Returns #F
    iSqlRow (TableB) is the parent of iChildList (TableA), they’re joined with TableB_Id being TableA_Fk. iChildList needs to be filled first, so the idea is that when the user saves the list he made, it ceates an iSqlRow in the background, that goes straight to tableB, with an auto incremented Id. From there, I’m updating TableA_Fk. So I’d like to fetch the Ids previously created during the dowork() to add the where clause.
    I hope I’m being clear, I feel like what I’m trying to explain makes no sense.
    Thanks in advance,
    Coralie.

    Coralie replied 5 years, 3 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.