Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Revisiting ...Imported records = 0

Featured Replies

:bang:

Maybe this should be under scripts.... not sure.

But here I am again!

Is there a code or anything that I can use to exit a script when the import record count=0 :(

1.I'm using "update matching" during import

2.This import file has no matching records (which can't be known until after I import)

I worked around this before but don't think I can this time.

I'm importing page after page and can't sit to watch the record import count.

Someone please help!

My brain is fried !!

Importing from what? If it's a FileMaker file, then there would be a way to test for Matching Records. But, I can't really see that it would be much different or faster. Are you matching against all records, or a found set?

Are you importing (updating) ONLY matching records, ie., is the Add new records option turned off? It sounds like it is.

There is an error code:

729

Errors occurred during import. Records could not be imported

  • Author

Importing from what?

[color:red]a .txt tab delim. file

Are you matching against all records, or a found set?

[color:red]all records

Are you importing (updating) ONLY matching records, ie., is the Add new records option turned off? It sounds like it is.

[color:red]Update matching and yes "Add new records" is turned off

There is an error code:

729

Errors occurred during import. Records could not be imported

I get a "0" error code..... no errors seem to be occuring. There just aren't any matching for it to update.

:(

I wasn't sure which forum this fit best but it's part of a script...

In a nut shell I'm:

Importing a .txt (tab delim) file to update a few fields, taking those found/matched records from this import and running a script marking them as edited.

Then going to the next file and importing....so on and so on.

There are at times 50 - 75 files and I can't watch the import of each one to make sure it has at least some matching records before going to the next script step of marking them as edited.

So now if no records match it shows all records after import and marks ALL as edited.... ugh.

If no records match, you should get a found set of zero following the import. If it shows all (or any) records, then these records were matched and updated. It's possible that they were "updated" with the same values they had before the import - but they were updated (including modification timestamp, if you turn auto-enter on).

  • Author

The found set IS "0" as I stated.

There are NO matching records being updated. I know this to be the case.

i use "Preform without dialog" so at this point it goes to basically "show all" records so that my script continues and EVERY record gets marked as "updated"

I need to find something generated by this "0" found records to use to exit the script!

I don't follow. Why don't you mark records as 'updated' immediately after the import - so that if the found set is 0, no records are marked?

How would FileMaker know that there are no records to be update until it has looked at all of the records in the found set, and then completed the script?

Ermmm...have you tried putting this immediately after the Import[]?

If[Get(FoundCount) = 0]

Exit Script

End If

  • Author

First thanks to everyone for trying... really.

But it was as simple as.....

Import records

If[Get(FoundCount) = 0]

Exit Script

End If

.....Worked just fine!

Sorry some weren't getting this or realizing what was happening but to answer a few:

I don't follow. Why don't you mark records as 'updated' immediately after the import - so that if the found set is 0, no records are marked?

That's exactly how it was set up but because immediately following the import if there were no errors and no records matched to update it "shows all" like I said before and then proceeds to mark all as updated.

How would FileMaker know that there are no records to be update until it has looked at all of the records in the found set, and then completed the script?

"...and then completed the script?" :(?

Not sure why it would need to complete the script but thanks anyway.........

I expected that FileMaker would know right after the import that no records were updated since if you uncheck the "preform without dialog" and watch step by step you get the display....

Import records summary:

Total records added/updated: 0

Total records skipped due to errors:0

Total records fields skipped due to errors: 0

Table created:

and get an error code of : 0

Anyway........ I have what I needed and thanks !!

"I expected that FileMaker would know right after the import that no records were updated..."

FileMaker *does* know... the challenge is to program your script so that it recognises the condition and can behave accordingly. :(

  • Author

I figured, but I just couldn't see what I needed to do........

Maybe I should have put this in scripts so that it was more obvious what I needed

Whenever you're doing a process that needs to work with a found set of records, think about what would happen if 1) the whole database is selected; or 2) no records are selected. Script accordingly. :(

Usually these checks should be done after a find, an import, or before an export or a looping script that processes a found set of records. Even if there is "no way" the found set could be empty (or whatever).

I once worked on a solution (not originally done by me) where a process failed in the most obscure manner because there was an empty found set where it was impossible to have one. What had happened was the data had been recently imported but the primary key hadn't been set! A quick and simple check for IsEmpty( relationship::primarykey ) in the process would have spotted it but the original developer considered such defensive programming techniques as a waste of time and unnecessary. It took many hours to debug and fix. ;(

  • Author

Good point! It'll make me go through everything again to check my scripting for potential problems !

But hey considering that I build cabinets for a living and have no programing type training at all it's understandable that I missed something like that....

"ut hey considering that I build cabinets for a living and have no programing type training at all it's understandable that I missed something like that...."

Yes... but it's like me building something out of wood (expensive wood, at that) and not taking into account the fact that wood changes with humidity; I end up making something that will, in time expand, warp or self-destruct. ;(

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.