how to identify imported records

How can I methodically isolate a group of records that has just been imported?

After an import, instead of the found set being the just-imported records, the found set is all records. I want to isolate the new records and apply various processes to them.

Thanks,

Jim

If you use a timestamp column, get the maximum timestamp in the table before importing and then find all records greater than that. The only thing to watch for is that no one adds records from getting the max timestamp and the finish of the import.

or better yet, set the timestamp of the import to the same for all imported records and find on that.

Scott

I’m looking for a way to do this that does not involve (as I understand that you suggest, Scott) setting a timestamp in the originating file and then (somehow) carrying it over to Servoy. Also, there is no guarantee that someone else will not have created a record after the timestamp is set, as you noted.

I tried setting a timestamp in a global, and then having a field that auto-enters that value during import, and then finding that value after import. But as there is no field property to ‘lookup only on import’, the field will always look up the value in the global… not just upon import, but whenever a user creates a new record in that table.

A kludgey solution can probably be obtained, involving a dummy field or two. But it seems to me such a typical concern, importing data and then doing something with it, that surely there would be a way to accomplish this more elegantly.

What have others done?

Well I can think of 2 ways to do this:

  1. instead of using a timestamp you can use a UID and store that in the table and query that after the import.
var UID = new java.rmi.server.UID();

Ofcourse this pollutes the database, unless you want to keep track of import sets.

  1. Depending on the way you import…when you do it with a method then you can request the PK of an inserted record and store that in an array.
    After you imported all the data you use controller.loadRecords(myArrayWithPKs).

Hope this helps.

Why is the imported record set not retained as the found set? Would this not be the expected default behavior?

The solutions offered so far (which are appreciated!) are of the workaround variety. Is the problem of manipulating imported sets not common enough to warrant Servoy’s attention, or are there insurmountable technical challenges to doing so?

We anticipate doing- on an ongoing basis- many imports of existing data for new customers in an ASP solution. (Sometimes, we get new data to import for existing customers, too.) There are related tables to import, and it is necessary to import their existing key fields, then reference them while creating new key field values in Servoy. The ability to have the imported record set retained as the found set would be super-useful.

Jim

jim:
Why is the imported record set not retained as the found set? Would this not be the expected default behavior?

As far as I know this is only expected behavior in FileMaker Pro.
I have not seen this behavior in any SQL front-end.
Also if you do lots of imports with lots of data you might want to consider importing it straight into the back-end database.

Hi Jim, I am currently reworking the Data Plugin to provide true import for tables that have db sequence id’s.

The import will be scriptable with or without a dialog showing. Like with the current methods it will (first) create a dataset of the import. You could then use that dataset I guess…

Thanks! I’ll look for the announcement on the new improved plugin.

I assume this requires using db sequencing and not Servoy…?

Jim

Jim:
I assume this requires using db sequencing and not Servoy…?

IT2Be:
…to provide true import for tables that have db sequence id’s.

Indeed…