Jump to content

Cannot Create New Record


This topic is 6997 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am trying to read in the titles of files in a folder, add records to a FM database and fill in a field with the title of each of the files. I cannot get the command to create a new record to work. I have searched this forum as well as other internet resources with no success.

At the "create new record" step, I get the "Set Data failed. Invalid data was supplied" error. What am I messing up here?

-----------------------------------------------------

copy (choose folder) to foldername --select the source folder

copy (list folder foldername) to folderstuff

copy (count of folderstuff) to thecount

copy {} to fileList

repeat with num1 from 1 to thecount -- copy the aliases of the text files to FileList

copy ((foldername as string) & item num1 of folderstuff) to myfile

copy fileList & (myfile as alias) to fileList

end repeat

tell application "FileMaker Pro"

tell database "metaDataEntry.fp7"

show layout "metaDataEntry"

repeat with fileName in fileList --now process the files in FileList

{name} of (info for fileName) returning {shortname}

--tell application "FileMaker Pro" to tell window (my FileLoggerDB)

tell table "metaDataEntry"

display dialog "Before Create" buttons {"Cancel", "Okay"}

set thisRecord to create new record

display dialog "After Create" buttons {"Cancel", "Okay"}

show thisRecord

--set cell "Title" of current record to shortname

save -- if you don't do this, you run into trouble after processing long file lists

end tell

end repeat

end tell

end tell

------------------------------------------------------

Thank you very much for your help,

Nancy

Link to comment
Share on other sites

I have test the follow script :


set thenumber to : 500

tell database "metaDataEntry.fp7"

	show layout "metaDataEntry"

	repeat  thenumber times

		tell table "metaDataEntry"

			set thisRecord to create new record

			show thisRecord

			save

		end tell

	end repeat

end tell

And I have no error.

Link to comment
Share on other sites

This topic is 6997 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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