2011-04-23 5 views
0

테이블 출처를 로컬 파일에서 외부 원본 파일로 일괄 적으로 변경하는 방법이 있습니까?FileMaker : 테이블 원본 출처 변경 일괄 처리

상황 : 수십 개의 테이블 발생 15 개가 포함 된 데이터베이스를 관리합니다. 일부 사용자는 느린 인터넷 연결로 데이터베이스에 액세스합니다. 대부분의 테이블은 전체 작업 그룹에 대해 업데이트해야하지만 다른 테이블 및 UI 정보의 일부 데이터는 대부분 정적입니다.

데이터베이스 복사본을 가져 와서 로컬 파일 원본에서 기존 원본 서버의 외부 원본으로 공유해야하는 테이블의 테이블 발생을 변경하고 싶습니다. 하지만 수천 번의 클릭이 필요하고 부정확 해지는 경향이 있습니다. 프로세스를 자동화 할 수 있으면 훨씬 좋습니다. (내 판매 테이블의 모든 발생이 로컬 파일에서 외부 소스로 이동하도록 지정하려면)

더 나은 방법이 없다면 AppleScript의 UI 스크립팅으로 뭔가를 할 수 있다는 것을 알고 있습니다.

답변

2

지금까지 답변이 없으므로 어제 썼습니다. 그것은 더럽고 오래 견디며 오류를 잡아 내지 못합니다. 그러나 그것은 일을 할 것이고 미래를위한 것입니다.

--to prepare to run this script, you should already have the External Data Source set up 
--you should also open the Manage > Database menu and select the "Relationships" tab 

--set newDataSource to the name of the new external data source 
set newDataSource to "" 

--obtain tableOccurrences from TableNames (Get (FileName)) in the Data Viewer and copy the list into the tableOccurrences variable below 
--note that tableOccurrences will be a return-separated list which is quite long when set 
set tableOccurrences to "" 

--a list of which tables should be moved from the local file to the hosted file. Note that these should be proper table names not table occurrences 
set tablesToReplace to {"table1", "table2", ..., "tableN"} 

tell application "FileMaker Pro Advanced" 
    activate 
end tell 

set AppleScript's text item delimiters to {return} 
set j to the number of text items of tableOccurrences 

repeat until j < 1 
    tell application "System Events" 
     tell application Process "FileMaker Pro Advanced" 
      keystroke text item j of tableOccurrences 
      keystroke "o" using command down 
      delay 1 

      set i to 1 
      repeat until ((i > (count of rows of table 1 of scroll area 1 of window 1)) or selected of row i of table 1 of scroll area 1 of window 1) 
       set i to i + 1 
      end repeat 

      if (i <= (count of rows of table 1 of scroll area 1 of window 1) and name of static text of row i of table 1 of scroll area 1 of window 1 is in tablestoReplace) then 
       set currentMasterTable to name of static text of row i of table 1 of scroll area 1 of window 1 
       set currentOccurrenceName to value of text field 1 of window 1 
       click pop up button 1 of window 1 
       tell menu 1 of pop up button 1 of window 1 
        click menu item newDataSource 
       end tell 

       set k to 1 
       set tableSelected to false 
       repeat until tableSelected or k > (count of rows of table 1 of scroll area 1 of window 1) 
        if name of static text of row k of table 1 of scroll area 1 of window 1 = currentMasterTable then 
         select row k of table 1 of scroll area 1 of window 1 
         set tableSelected to true 
        end if 
        set k to k + 1 
       end repeat 

       set value of text field 1 of scroll area 1 of window 1 to currentOccurrenceName 
       click button "OK" of window 1 
      else 
       click button "Cancel" of window 1 
      end if 
     end tell 
    end tell 
    set j to j - 1 
end repeat 
+0

"할 수 없었습니다."라고 말하면서 유혹을 되풀이했지만 누군가 다른 사람이 생각 나게한다고 생각했습니다. 인상적인 솔루션. – Chuck