#author("2022-04-11T13:32:34+00:00","default:sysosa","sysosa") #author("2022-04-11T13:39:38+00:00","default:sysosa","sysosa") Clarisと社名が変更になった. 本家 [[https://www.claris.com/ja/>+https://www.claris.com/ja/]] 商品名は「Claris FileMaker」 [[XMLの取り扱い>FileMaker/XML]] [[FMのデータからファイルを作成>FileMaker/create_file]] [[firewall>FileMaker/firewall]] [[server>FileMaker/server]] ***PMIDからメタデータを取得する [#td1bd608] PMIDなる数字のフィールドを用意して、その値を元にPUBMEDのメタデータを取得して結果をJsonData[テキスト]フィールドに収めるスクリプト #code(nonumber){{ レコード/検索条件/ページへ移動 [最初の] Loop If [ IsEmpty ( pubmed::PMDI )] 全スクリプト終了 End If URL から挿入[選択; ダイアログあり:オフ; ターゲット:pubmed::jsonData; "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&retmode=json&id=" & pubmed::PMID] # DOSと間違われないようにするためインターバルを設置 スクリプト一時停止/続行 [間隔(秒): 3] レコード/検索条件/ページへ移動 [次の; 最後まできたら終了;オン] End Loop }} これで得られたJsonDataフィールドを使って1stAuthorを得るには、データベースにfirstAuthor[計算]フィールドを作って その計算式は下記のようにする #code(nonumber){{ JSONGetElement ( jsonData ; "result." & PMID & ".authors[0].name") }} またlastAuthorを得るなら、lastAuthor[計算]フィールドを作って、同じくその計算式には #code(nonumber){{ JSONGetElement ( jsonData ; "result." & PMID & ".lastauthor") }} とする。 他 #code(nonumber){{ Title --> JSONGetElement ( jsonData ; "result." & PMID & ".title") Journal名 --> JSONGetElement ( jsonData ; "result." & PMID & ".source") Volume --> JSONGetElement ( jsonData ; "result." & PMID & ".volume") Issue --> JSONGetElement ( jsonData ; "result." & PMID & ".issue") Page --> JSONGetElement ( jsonData ; "result." & PMID & ".pages") ELocationID -> JSONGetElement ( jsonData ; "result." & PMID & ".elocationid") pubdate(出版日) -> JSONGetElement ( jsonData ; "result." & PMID & ".pubdate") epubdate(電子出版日) -> JSONGetElement ( jsonData ; "result." & PMID & ".epubdate") }} 著者一覧 #code(nonumber){{ Replace ( while ( [ count = 0 ; authors = "" ] ; count < ValueCount ( JSONListKeys ( PMID_jsonData; "result." & PMID & ".authors") ) ; [ authors = authors & "," & JSONGetElement ( PMID_jsonData ; "result." & PMID & ".authors[" & count & "].name"); count = count + 1 ]; authors ) ; 1;1;"") }} ***DOIからメタデータを取得する [#xa5dc351] 基本的にPMDIから...と同じ. ただDOIの方は氏名がフルで書かれているみたいで、それを取得してみる っで作ったスクリプト #code(nonumber){{ レコード/検索条件/ページへ移動 [最初の] Loop If [ IsEmpty (DOI)] 全スクリプト終了 End If If [ DOI_json = "" ] URL から挿入[選択; ダイアログあり:オフ; ターゲット:DOI_json; "https://api.crossref.org/works/" & DOI] スクリプト一時停止/続行 [間隔(秒): 10] End If 変数を設定 [$authorCount; 値: ValueCount(JSONListKeys ( DOI_json ; "message.author" ))] 変数を設定 [$i; 値: 0] If [ $authorCount > 0 ] Loop 変数を設定 [$seq; 値: JSONGetElement ( DOI_json ; "message.author[" & $i & "]sequence" )] if [ $seq = "first" ] 変数を設定 [ $given; 値: JSONGetElement ( DOI_json ; "message.author[" & $i & "]given")] 変数を設定 [ $family; 値: JSONGetElement ( DOI_json ; "message.author[" & $i & "]family")] フィールド設定 [ DOI_json_1stAuthor ; $family & " " & $given ] End If 変数を設定 [$i; 値: $i + 1 ] Exit Loop If [ $i >= $authorCount ] End Loop End If レコード/検索条件/ページへ移動 [次の; 最後まできたら終了;オン] End Loop }} DOIのデータから論文誌を抽出するには #code(nonumber){{ Substitute ( JSONGetElement ( DOI_json ; "message.short-container-title" ); [ "[\"" ; "" ]; [ "\"]" ; "" ] ) }} 同じくタイトルを抽出するには #code(nonumber){{ Substitute ( JSONGetElement ( doi_jsonData ; "message.title" ); [ "[\"" ; "" ]; [ "\"]" ; "" ] ) }} とする #code(nonumber){{ JSONGetElement ( doi_jsonData ; "message.volume" ) JSONGetElement ( doi_jsonData ; "message.page" ) JSONGetElement ( doi_jsonData ; "message.issue" ) Substitute ( JSONGetElement ( doi_jsonData ; "message.created.date-parts" ); [ "[\"" ; "" ]; [ "\"]" ; "" ]; [ "[" ; "" ]; [ "]" ; "" ] ) }} 著者一覧 #code(nonumber){{ Replace ( while ( [ count = 0 ; authors = "" ] ; count < ValueCount ( JSONListKeys ( DOI_jsonData ; "message.author" ) ) ; [ authors = authors & "," & JSONGetElement ( DOI_jsonData ; "message.author[" & count & "].given") & " " & JSONGetElement ( DOI_jsonData ; "message.author[" & count & "].family") ; count = count + 1 ]; authors ) ; 1;1;"") }} ***外部 SQL データソース(ESS:External SQL Data Source) [#m6d61dda] オラクル内に作ったAERSの各種データをFMで閲覧できないかと考え、ESSを思いつく。 win7の「ODBCデータソースアドミニストレーター」なるものの「システムDSN」にオラクルさんのInstantClientを 用意したら認識できた。&color(red){*};「ユーザDSN」に置いていると見えなかった。 &ref(2013y01m22d_223302404.png,nolink); ***カスタム関数 [#q351d7e5] &ref(2018y07m29d_012047052.png,nolink); グローバル格納の「str」を作って、複数行で入力可能とします。 その入力値を使って「text」を検索して、ヒットした文字列を赤字/太字にするカスタム関数 #code(nonumber){{ Case( $$#c = ""; Let( [ $$#c = 1 ; $$#res = text ]; ColorText( str ; text) ); $$#c > ValueCount( str ) ; Let( [ $$#c = ""; #res = $$#res; $$#res = "" ]; #res ); $$#c =< ValueCount(word) ; /* 「=<」はFileMakerでは表記が異なる */ Let( [ $$#res = Substitute ( $$#res ; GetValue ( str ; $$#c ) ; TextStyleAdd ( TextColor( GetValue ( str ; $$#c ) ; RGB ( 255 ; 0 ; 0 )) ; 太字 ) ); $$#c = $$#c + 1 ]; ColorText( word; text) ) ) }}