In Tango for FileMaker version 1.61 an Insert action would return the record
ID, which you could retrieve with <@actionResult>. In this millenium you
have to use other techniques. Scott and JJ's suggestion works in SQL Server
and I believe Sybase. In other databases you can search for the record
inserted to get the primary key. In a multi-user environment you may want to
insert a random number or userReference into the record to ensure that you
get the right one in case two people insert records at exactly the same
time.

Dave.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of JJ Smith
> Sent: Tuesday, April 30, 2002 9:33 PM
> To: Multiple recipients of list witango-talk
> Subject: Re: Witango-Talk: Identity after Insert
>
>
> Hi Brad/Scott,
>
> I think Scott and I were making the same suggestion.
> This will work fine for sql-server and like Scott I
> can't speak for all databases. However I had to do the
> same thing before for Oracle and the solution is
> slightly different. Immediately after the insert do a
> DBMS with the following:
>
> select <@literal tablename_Sequence.CURRVAL> from
> tablename;
>
> then like before in the results:
>
> <@assign "local$newidentityId"
> "@@local$resultSet[1,1]">
>
>
> This is a bit specific but may be of use to someone in
> the future who needs to do the same thing with an
> Oracle database.
>
> JJ
>
> --- Scott Cadillac
> <[EMAIL PROTECTED]> wrote:
> > Hi Brad,
> >
> > Nice suggestion, but of course it could get weird
> > for this databases that
> > don't support this kind of functionality, being that
> > is usually SQL
> > specific.
> >
> > Of course I can't speak for other Databases as I
> > mostly only use MS
> > SQL-Server. So in the meantime, if you use
> > SQL-Server, you could just use
> > another Direct_DBMS Action directly after your
> > Insert Action instead of a
> > stored procedure. And just type the following:
> >
> > SELECT <@literal value=@><@literal value=@>IDENTITY
> > AS 'Identity'
> >
> > Then use,
> >
> > <@VAR local$resultSet[1,Identity]> to get the new
> > identity.
> >
> > Hope this helps a little. Cheers...
> >
> > Scott Cadillac
> > http://xml-extra.net
> > [EMAIL PROTECTED]
> >
> > ----- Original Message -----
> > From: "Brad Robertson"
> > <[EMAIL PROTECTED]>
> > To: "Multiple recipients of list witango-talk"
> > <[EMAIL PROTECTED]>
> > Sent: Tuesday, April 30, 2002 5:37 PM
> > Subject: Witango-Talk: Identity after Insert
> >
> >
> > I am currently using a Direct DBMS action in wTango
> > that calls a stored
> > procedure to insert a record and then return the new
> > identity of that field,
> > it seems that works better than a insert then search
> > action to get the
> > identity field.  I was wondering if 5.0 or later
> > will have the ability to
> > grab this field on insert, or if anybody has a less
> > tedious way of doing
> > this...
> >
> > Brad
> >
> >
> >
> >
> ________________________________________________________________________
> > TO UNSUBSCRIBE: send a plain text/US ASCII email to
> > [EMAIL PROTECTED]
> >                 with unsubscribe witango-talk in the
> > message body
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
> ________________________________________________________________________
> TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
>                 with unsubscribe witango-talk in the message body

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to