Using FileMaker as ODBC Source

Peter Haworth pete at lcsql.com
Tue Sep 15 12:42:31 EDT 2015


Hi Javier,
According to the dictionary entry for revOpenDatabase, you need to use the
cursortype parameter for ODBC connections.  The defualt is "forward only"
which does not support the use of revMoveToFirstRecord,
revMoveToLastRecord, and revMoveToPreviousRecord.

It looks like a cursortype of "emulated static" will work for what you need
to do.

I couldn't quite figure out what you are trying to do by going to the last
record but if you just need to know how many records are in the cursor, you
can use revNumberOfRecords(theCursor) instead of going to the last record

Pete

On Mon, Sep 14, 2015 at 9:35 PM Javier Miranda <jemirandav at gmail.com> wrote:

> Hi friends, can you take a look to this code please?
>
> on mouseUp
>    put "ODBC" into theDBType
>    put "localhost" into theDBHost
>    put "SACyV" into theDBName
>    put "Admin" into theDBUser
>    put  “bcdea" into theDBPassword
>    put revOpenDatabase( theDBType, theDBName , theDBHost, theDBUser,
> theDBPassword ) into theConnectionID
>    put revQueryDatabase( theConnectionID, "SELECT * FROM Almacen") into
> theCursor
>    revMoveToLastRecord theCursor
>    --put the result  (It puts false in the msg)
>    put revCurrentRecord(theCursor) + 1 into field RegAct
>    put revDatabaseColumnNamed(theCursor, TotRec) & return & Total into
> field RegNum
>    set the endValue of Scrollbar Marcador to revCurrentRecord(theCursor) +
> 1
>    set the  thumbposition of Scrollbar Marcador to 1
>    put revDatabaseColumnNamed(theCursor, ItemID) into field ItemID
>    put revDatabaseColumnNamed(theCursor, Producto) into field Producto
>    put revDatabaseColumnNamed(theCursor, Marca) into field Marca
> end mouseUp
>
> It successfully establishes a connection to a datasource (A FileMaker 13
> database), makes SQL query, put some values into certain fields in the card
> and put the fields of the record in the corresponding cards fields.
> The problem is doesn’t “like” revMoveToLastRecord theCursor.
> I tried to use these commands To navigate the records in the result set:
> - revMoveToFirstRecord <cursor id>
> - revMoveToPreviousRecord <cursor id>
> - revMoveToNextRecord <cursor id>
> - revMoveToLastRecord <cursor id>
> But none of them seems to work. Is this a limitation of the ODBC driver?
> And  if it is, what have to be done to navigate the records in the cursor?
> Saludos,
> Javier
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the Use-livecode mailing list