August 16, 200817 yr :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 !!
August 16, 200817 yr 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
August 16, 200817 yr 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.
August 17, 200817 yr 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).
August 17, 200817 yr 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!
August 17, 200817 yr 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?
August 17, 200817 yr 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?
August 17, 200817 yr Ermmm...have you tried putting this immediately after the Import[]? If[Get(FoundCount) = 0] Exit Script End If
August 17, 200817 yr 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 !!
August 17, 200817 yr "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. :(
August 18, 200817 yr 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
August 18, 200817 yr 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. ;(
August 18, 200817 yr 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....
August 18, 200817 yr "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