September 29, 200520 yr Hello, Preface: I'm working with FM Pro 6. In my case I have an AppleScript that uses a tell application "Filemaker Pro" block in it to retrieve records from a Works database table that has relations to three other tables (titles, creators, images). So in the layouts, there will be references to fields like "Titles::Title Qualifier", etc. The problem I'm having is that when I reference the related data in a set statement it works most times but not others. I don't understand why the syntax will work in one place and not the other. The only issue that I thought was the fact that all the references were not on the same layout. But even adding code to switch layouts before using the set statement did not work. Below is a snippet of the code. All related field references work successfully except for the last one. Any suggestions would be greatly appreciated. Thanks in advance, Jack -- SUBROUTINE AND VARIABLE INITIALIZATION OMITED... tell application "FileMaker Pro" --Prompt for the desired project to export from IRIS display dialog "Enter the project name:" default answer "backlog" set projectNameValue to text returned of the result -- UNIMPORTANT CODE REMOVED... open irisDirectory & irisTitles with password irisPassword set irisTitlesDB to (a reference to database irisTitles) if (exists irisTitlesDB) is false then display dialog "There is a problem finding the " & irisDirectory & irisTitles & " file. Click Cancel and resolve this, then run the script again." return end if open irisDirectory & irisRepository with password irisPassword set irisRepositoryDB to (a reference to database irisRepository) if (exists irisRepositoryDB) is false then display dialog "There is a problem finding the " & irisDirectory & irisRepository & " file. Click Cancel and resolve this, then run the script again." return end if open irisDirectory & irisWCreator with password irisPassword set irisWCreatorDB to (a reference to database irisWCreator) if (exists irisWCreatorDB) is false then display dialog "There is a problem finding the " & irisDirectory & irisWCreator & " file. Click Cancel and resolve this, then run the script again." return end if open irisDirectory & irisWSLinks with password irisPassword set irisWSLinksDB to (a reference to database irisWSLinks) if (exists irisWSLinksDB) is false then display dialog "There is a problem finding the " & irisDirectory & irisWSLinks & " file. Click Cancel and resolve this, then run the script again." return end if open irisDirectory & irisWorks with password irisPassword set irisWorksDB to (a reference to database irisWorks) if (exists irisWorksDB) is false then display dialog "There is a problem finding the " & irisDirectory & irisWorks & " file. Click Cancel and resolve this, then run the script again." return end if -- Identify the works to be exported and get their corresponding image records. tell database irisWorks if (projectNameValue ≠ "") then set workList to (ID of every record whose (cellValue of cell "Project Name" = projectNameValue)) as list else set workList to (ID of every record whose (cellValue of cell "Approved" ≠ "")) as list end if set workCount to count of workList -- Loop through the works and identify approved works to be exported. repeat with workIndex from 1 to workCount set workRecord to (a reference to record ID (item workIndex of workList as integer)) go to layout "Data Entry/Edit Page 1" set workNumber to cellValue of cell "Work No." of workRecord -- Only export works that have been approved. if ((cellValue of cell "Approved" of workRecord) ≠ "") then set projectWorkCount to projectWorkCount + 1 set workNumber to cellValue of cell "Work No." of workRecord set workProjectName to cellValue of cell "Project Name" of workRecord as text set workTitle to cellValue of cell "Titles::Title" of workRecord as list set workTitleQualifier to cellValue of cell "Titles::Title Qualifier" of workRecord as list set workCategories to cellValue of cell "Category" of workRecord as list set workSubjects to cellValue of cell "Subjects" of workRecord as list set workSubjectAuthority to my getSubjectAuthority(workSubjects) as list set workSubjectSubtypes to cellValue of cell "Subject Subtypes" of workRecord as list set workSubjectSubtypeAuthority to my getSubtypeAuthority(workSubjectSubtypes) as list set workMaterials to cellValue of cell "Materials" of workRecord as list set workCentury to cellValue of cell "Century" of workRecord as list set workStartYear to cellValue of cell "Start Year" of workRecord as text set workEndYear to cellValue of cell "End Year" of workRecord as text set workDates to cellValue of cell "Work Dates" of workRecord as text set workEra to cellValue of cell "Era" of workRecord as text set workCountry to cellValue of cell "Country" of workRecord as list set workType to cellValue of cell "Work Type" of workRecord as list set workTypeAuthority to my getWorkTypeAuthority(workType) as list if (exists (cellValue of cell "Current Site" of workRecord)) then set workCurrentSite to cellValue of cell "Current Site" of workRecord as text else set workCurrentSite to "" as text end if if (exists (cellValue of cell "Former Site" of workRecord)) then set workFormerSite to cellValue of cell "Former Site" of workRecord as text else set workFormerSite to "" as text end if set workLocality to cellValue of cell "Locality" of workRecord as text set workDimensions to cellValue of cell "Dimensions" of workRecord as text set workCulture to cellValue of cell "Culture" of workRecord as list set workCultureAuthority to my getCultureAuthority(workCulture) as list set workPeriod to cellValue of cell "Period" of workRecord as list set workPeriodAuthority to my getPeriodAuthority(workPeriod) as list set workTechniques to cellValue of cell "Techniques" of workRecord as list if (exists (cellValue of cell "sRepository Display" of workRecord)) then set workRepositoryDisplay to cellValue of cell "sRepository Display" of workRecord as text if (exists (cellValue of cell "Repository::Repository Authority" of workRecord)) then set workRepositoryAuthority to cellValue of cell "Repository::Repository Authority" of workRecord as text else set workRepositoryAuthority to "" as text end if else set workRepositoryDisplay to "" as text set workRepositoryAuthority to "" as text end if set workRepositoryNumber to cellValue of cell "Repository No." of workRecord as text set workCollector to cellValue of cell "Collector" of workRecord as text set workCatalogersNotes to cellValue of cell "Cataloger's Notes" of workRecord as text set workPID to cellValue of cell "PID" of workRecord as text set creatorIdList to cellValue of cell "WCreator::Creator ID" of workRecord as list set workCreatorName to cellValue of cell "WCreator::Creator Name" of workRecord as list set workCreatorQualifier to cellValue of cell "WCreator::Creator Qualifier" of workRecord as list set workCreatorRole to cellValue of cell "WCreator::Creator Role" of workRecord as list set workCreatorDates to cellValue of cell "WCreator::Creator Dates" of workRecord as list set workCreatorAuthority to my getCreatorAuthority(creatorIdList) as list set workExportDate to cellValue of cell "Export Date" of workRecord do script "Go to List Assoc. Images" -- THE LINE BELOW WONT RETURN THE DATA EXPECTED BUT THE ONES ABOVE WORK set workImageList to cellValue of cell "WSLinks::Surrogate No." of workRecord as list set workTitleCount to count of workTitle set workCreatorCount to count of creatorIdList
Create an account or sign in to comment