Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Saxon Visualize electronic Invoices

All examples are included with download of MBS FileMaker Plugin.

Saxon Visualize electronic Invoices.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 12
Value Lists 0
Custom Functions 0
Custom Menus 24
File Options
Default custom menu set [Standard FileMaker Menus]
Default theme Apex Blue
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password On
Require iOS passcode Off
Show Sign-in fields On
Switch to layout Off
Hide all toolbars Off
Script triggers
OnFirstWindowOpen Off
OnLastWindowClose Off
OnWindowOpen Off
OnWindowClose Off
OnFileAVPlayerChange Off
OnWindowTransaction Off
Thumbnail Settings
Generate Thumbnails On; Temporary

 

Tables

Table Name
Statistics
Comments
Occurrences in Relationship Graph
Saxon Visualize electronic Invoices
11 fields defined, 1 record
Saxon Visualize electronic Invoices

Fields

Table Name: Saxon Visualize electronic Invoices - 11 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
PrimaryKey Normal, Text Auto-Enter: Validation:
  • Only during data entry
  • Not empty
  • Unique
  • Strict validation
Storage:
  • Repetitions: 1
  • Indexing: Minimal
  • Automatically create indexes as needed
  • Index Language: Unicode Raw
Unique identifier of each record in this table
          CreationTimestamp Normal, Timestamp Auto-Enter:
          • Creation timestamp
          Validation:
          • Only during data entry
          • Strict data type: 4 digit year
          • Not empty
          • Strict validation
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
          Date and time each record was created
                  CreatedBy Normal, Text Auto-Enter:
                  • Creation account name
                  Validation:
                  • Only during data entry
                  • Not empty
                  • Strict validation
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                  Account name of the user who created each record
                          ModificationTimestamp Normal, Timestamp Auto-Enter:
                          • Modification timestamp
                          Validation:
                          • Only during data entry
                          • Strict data type: 4 digit year
                          • Not empty
                          • Strict validation
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                          Date and time each record was last modified
                                  ModifiedBy Normal, Text Auto-Enter:
                                  • Modification account name
                                  Validation:
                                  • Only during data entry
                                  • Not empty
                                  • Strict validation
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                  Account name of the user who last modified each record
                                          XSLFolder Normal, Text Auto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Global
                                          • Repetitions: 1
                                          • Index Language: German
                                              Invoice XML Normal, Text Auto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                              • Indexing: None
                                              • Automatically create indexes as needed
                                              • Index Language: German
                                                  Intermediate XML Normal, Text Auto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                  • Indexing: None
                                                  • Automatically create indexes as needed
                                                  • Index Language: German
                                                      HTML Normal, Text Auto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: German
                                                          PDF Normal, Binary Auto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Repetitions: 1
                                                              Notes Normal, Text Auto-Enter: Validation:
                                                              • Only during data entry
                                                              Storage:
                                                              • Repetitions: 1
                                                              • Indexing: None
                                                              • Automatically create indexes as needed
                                                              • Index Language: German

                                                                    Layout Objects: Saxon Visualize electronic Invoices

                                                                    Regular Fields

                                                                    Field Name: Saxon Visualize electronic Invoices::XSLFolder
                                                                    Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                    • Top: 755 pt
                                                                    • Left: 123 pt
                                                                    • Bottom: 786 pt
                                                                    • Right: 442 pt
                                                                    • Anchoring: Left, Bottom
                                                                    Field Format:
                                                                    • Edit Box
                                                                    Field Behavior:
                                                                    • Allow field to be entered: In Find mode, In Browse mode
                                                                    • Touch keyboard type: Default for Data Type
                                                                    • Go to next field using: Tab key
                                                                    No

                                                                    Field Name: Saxon Visualize electronic Invoices::Invoice XML
                                                                    Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                    • Top: 125 pt
                                                                    • Left: 204 pt
                                                                    • Bottom: 242 pt
                                                                    • Right: 381 pt
                                                                    • Anchoring: Left, Top
                                                                    Field Format:
                                                                    • Edit Box
                                                                    Field Behavior:
                                                                    • Allow field to be entered: In Find mode, In Browse mode
                                                                    • Touch keyboard type: Default for Data Type
                                                                    • Go to next field using: Tab key
                                                                    Yes

                                                                    Field Name: Saxon Visualize electronic Invoices::Intermediate XML
                                                                    Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                    • Top: 125 pt
                                                                    • Left: 572 pt
                                                                    • Bottom: 242 pt
                                                                    • Right: 749 pt
                                                                    • Anchoring: Left, Top
                                                                    Field Format:
                                                                    • Edit Box
                                                                    Field Behavior:
                                                                    • Allow field to be entered: In Find mode, In Browse mode
                                                                    • Touch keyboard type: Default for Data Type
                                                                    • Go to next field using: Tab key
                                                                    Yes

                                                                    Field Name: Saxon Visualize electronic Invoices::HTML
                                                                    Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                    • Top: 125 pt
                                                                    • Left: 756 pt
                                                                    • Bottom: 242 pt
                                                                    • Right: 933 pt
                                                                    • Anchoring: Left, Top
                                                                    Field Format:
                                                                    • Edit Box
                                                                    Field Behavior:
                                                                    • Allow field to be entered: In Find mode, In Browse mode
                                                                    • Touch keyboard type: Default for Data Type
                                                                    • Go to next field using: Tab key
                                                                    Yes

                                                                    Field Name: Saxon Visualize electronic Invoices::PDF
                                                                    Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                    • Top: 125 pt
                                                                    • Left: 21 pt
                                                                    • Bottom: 242 pt
                                                                    • Right: 197 pt
                                                                    • Anchoring: Left, Top
                                                                    Field Format:
                                                                    • Edit Box
                                                                    Field Behavior:
                                                                    • Allow field to be entered: In Find mode, In Browse mode
                                                                    • Touch keyboard type: Default for Data Type
                                                                    • Go to next field using: Tab key
                                                                    No

                                                                    Field Name: Saxon Visualize electronic Invoices::Notes
                                                                    Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                    • Top: 125 pt
                                                                    • Left: 388 pt
                                                                    • Bottom: 242 pt
                                                                    • Right: 565 pt
                                                                    • Anchoring: Left, Top
                                                                    Field Format:
                                                                    • Edit Box
                                                                    Field Behavior:
                                                                    • Allow field to be entered: In Find mode, In Browse mode
                                                                    • Touch keyboard type: Default for Data Type
                                                                    • Go to next field using: Tab key
                                                                    Yes

                                                                    Group Buttons

                                                                    Button Properties Coordinates Script/Script Step
                                                                      Type:
                                                                    • Text: Download xrechnung-visualization and point to XSL folder there.
                                                                      Additional Properties:
                                                                    • Rectangular
                                                                    • Top: 756 pt
                                                                    • Left: 454 pt
                                                                    • Bottom: 787 pt
                                                                    • Right: 927 pt
                                                                    • Anchoring: Left, Bottom
                                                                    Perform Script [ “Open Website” ]

                                                                    Scripts:


                                                                    Buttons

                                                                    Button Properties Coordinates Script/Script Step
                                                                      Type:
                                                                    • Text: Website
                                                                    • Top: 757 pt
                                                                    • Left: 936 pt
                                                                    • Bottom: 788 pt
                                                                    • Right: 1012 pt
                                                                    • Anchoring: Left, Bottom
                                                                    Perform Script [ “Open Website” ]

                                                                    Scripts:


                                                                    Button Properties Coordinates Script/Script Step
                                                                      Type:
                                                                    • Text: Show Invoice
                                                                      Additional Properties:
                                                                    • Change to hand cursor over button
                                                                    • Top: 214 pt
                                                                    • Left: 940 pt
                                                                    • Bottom: 242 pt
                                                                    • Right: 1059 pt
                                                                    • Anchoring: Left, Top
                                                                    Perform Script [ “Run” ]

                                                                    Scripts:


                                                                    Button Properties Coordinates Script/Script Step
                                                                      Type:
                                                                    • Text: Import PDF
                                                                      Additional Properties:
                                                                    • Change to hand cursor over button
                                                                    • Top: 125 pt
                                                                    • Left: 940 pt
                                                                    • Bottom: 153 pt
                                                                    • Right: 1059 pt
                                                                    • Anchoring: Left, Top
                                                                    Perform Script [ “Import PDF” ]

                                                                    Scripts:


                                                                    Button Properties Coordinates Script/Script Step
                                                                      Type:
                                                                    • Text: Import XML
                                                                      Additional Properties:
                                                                    • Change to hand cursor over button
                                                                    • Top: 160 pt
                                                                    • Left: 940 pt
                                                                    • Bottom: 188 pt
                                                                    • Right: 1059 pt
                                                                    • Anchoring: Left, Top
                                                                    Perform Script [ “Import XML” ]

                                                                    Scripts:


                                                                    Web Viewer Controls

                                                                    Web Viewer Control Properties Coordinates Web Address
                                                                      Additional Properties:
                                                                    • Allow interaction with web viewer content
                                                                    • Display progress bar
                                                                    • Display status messages
                                                                    • Automatically encode URL
                                                                    • Top: 252 pt
                                                                    • Left: 9 pt
                                                                    • Bottom: 738 pt
                                                                    • Right: 1059 pt
                                                                    • Anchoring: Left and Right, Top and Bottom
                                                                    If( IsEmpty( Saxon Visualize electronic Invoices::HTML ); "about:blank"; "data:text/html;charset=utf-8;base64," & Base64Encode( Saxon Visualize electronic Invoices::HTML ) )

                                                                    Script Hierarchy

                                                                    Run
                                                                    Run XSLT
                                                                    Clear
                                                                    -
                                                                    Load Saxon
                                                                    Open Website
                                                                    -
                                                                    Import PDF
                                                                    Import XML
                                                                    -
                                                                    InitDynaPDF
                                                                    Extract XML

                                                                    Next Script: [Run XSLT]
                                                                    Script Name Run
                                                                    Run script with full access privileges Off
                                                                    Siri Shortcut Visible Off
                                                                    Include In Menu Yes
                                                                    Layouts that use this script
                                                                    Scripts that use this script
                                                                      Script Definition
                                                                      Script Steps
                                                                      • #Load Saxon once if not yet loaded
                                                                      • If [ MBS("Saxon.IsLoaded") = 0 ]
                                                                      • Perform Script [ “Load Saxon” ]
                                                                      • End If
                                                                      • If [ IsEmpty ( Saxon Visualize electronic Invoices::XSLFolder ) ]
                                                                      • Show Custom Dialog [ Title: "You need to specify the folder with stylesheets."; Message: "Please download from github and put the path to XSL folder path into the field."; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Open URL [ "https://github.com/itplr-kosit/xrechnung-visualization/releases" ] [ No dialog ]
                                                                      • Exit Script [ ]
                                                                      • End If
                                                                      • If [ IsEmpty ( Saxon Visualize electronic Invoices::Invoice XML ) and not IsEmpty ( Saxon Visualize electronic Invoices::PDF ) ]
                                                                      • Perform Script [ “Extract XML” ]
                                                                      • End If
                                                                      • #We can do UBL invoices and Cross Industry Invoices (XRechnung)
                                                                      • If [ Position ( Saxon Visualize electronic Invoices::Invoice XML ; "urn:oasis:names:specification:ubl:schema:xsd:Invoice" ; 1 ; 1 ) > 1 ]
                                                                      • Perform Script [ “Run XSLT”; Parameter: "ubl-invoice-xr.xsl" ]
                                                                      • Else If [ Position ( Saxon Visualize electronic Invoices::Invoice XML ; "unece:uncefact:data:standard:CrossIndustryInvoice" ; 1 ; 1 ) ]
                                                                      • Perform Script [ “Run XSLT”; Parameter: "cii-xr.xsl" ]
                                                                      • End If
                                                                      Fields used in this script
                                                                      Scripts used in this script
                                                                      Layouts used in this script
                                                                        Tables used in this script
                                                                        Table occurrences used by this script
                                                                        Custom Functions used by this script
                                                                          Custom menu set used by this script

                                                                            Previous Script: [Run] Next Script: [Clear]
                                                                            Script Name Run XSLT
                                                                            Run script with full access privileges Off
                                                                            Siri Shortcut Visible Off
                                                                            Include In Menu No
                                                                            Layouts that use this script
                                                                              Scripts that use this script
                                                                              Script Definition
                                                                              Script Steps
                                                                              • Set Variable [ $XSLTName; Value:Get(ScriptParameter) ]
                                                                              • #Set the folder to find related files
                                                                              • Set Variable [ $r; Value:MBS( "Saxon.SetCurrentWorkingDirectory"; Saxon Visualize electronic Invoices::XSLFolder) ]
                                                                              • #we read invoice XML into variable
                                                                              • Set Variable [ $invoiceXML; Value:Saxon Visualize electronic Invoices::Invoice XML ]
                                                                              • #read the XSLT to convert
                                                                              • Set Variable [ $path; Value:MBS("Path.AddPathComponent"; Saxon Visualize electronic Invoices::XSLFolder; $XSLTName) ]
                                                                              • Set Variable [ $InvoiceXSLT; Value:MBS("Text.ReadTextFile"; $path; "utf-8") ]
                                                                              • If [ MBS("IsError") = 1 ]
                                                                              • Show Custom Dialog [ Title: "Failed to read XSLT. Please check path!"; Message: $InvoiceXSLT; Default Button: “OK”, Commit: “Yes” ]
                                                                              • Exit Script [ ]
                                                                              • End If
                                                                              • #Apply the XSLT
                                                                              • Set Variable [ $IntermediateXML; Value:MBS( "Saxon.XSLT"; $invoiceXML; $InvoiceXSLT ) ]
                                                                              • Set Field [ Saxon Visualize electronic Invoices::Intermediate XML; $IntermediateXML ]
                                                                              • If [ MBS("IsError") = 0 ]
                                                                              • #now get second XSLT to convert to HTML
                                                                              • Set Variable [ $path; Value:MBS("Path.AddPathComponent"; Saxon Visualize electronic Invoices::XSLFolder; "xrechnung-html.xsl") ]
                                                                              • Set Variable [ $HTMLXSLT; Value:MBS("Text.ReadTextFile"; $path; "utf-8") ]
                                                                              • #Generate the HTML
                                                                              • Set Variable [ $InvoiceHTML; Value:MBS( "Saxon.XSLT"; $IntermediateXML; $HTMLXSLT ) ]
                                                                              • #Store in the field
                                                                              • Set Field [ Saxon Visualize electronic Invoices::HTML; $InvoiceHTML ]
                                                                              • End If
                                                                              Fields used in this script
                                                                              Scripts used in this script
                                                                                Layouts used in this script
                                                                                  Tables used in this script
                                                                                  Table occurrences used by this script
                                                                                  Custom Functions used by this script
                                                                                    Custom menu set used by this script

                                                                                      Previous Script: [Run XSLT] Next Script: [-]
                                                                                      Script Name Clear
                                                                                      Run script with full access privileges Off
                                                                                      Siri Shortcut Visible Off
                                                                                      Include In Menu Yes
                                                                                      Layouts that use this script
                                                                                        Scripts that use this script
                                                                                        Script Definition
                                                                                        Script Steps
                                                                                        • Replace Field Contents [ Saxon Visualize electronic Invoices::PDF; Replace with calculation: "" ] [ No dialog ]
                                                                                        • Replace Field Contents [ Saxon Visualize electronic Invoices::HTML; Replace with calculation: "" ] [ No dialog ]
                                                                                        • Replace Field Contents [ Saxon Visualize electronic Invoices::Invoice XML; Replace with calculation: "" ] [ No dialog ]
                                                                                        • Replace Field Contents [ Saxon Visualize electronic Invoices::Intermediate XML; Replace with calculation: "" ] [ No dialog ]
                                                                                        Fields used in this script
                                                                                        Scripts used in this script
                                                                                          Layouts used in this script
                                                                                            Tables used in this script
                                                                                            Table occurrences used by this script
                                                                                            Custom Functions used by this script
                                                                                              Custom menu set used by this script

                                                                                                Previous Script: [Clear] Next Script: [Load Saxon]
                                                                                                Script Name -
                                                                                                Run script with full access privileges Off
                                                                                                Siri Shortcut Visible Off
                                                                                                Include In Menu Yes
                                                                                                Layouts that use this script
                                                                                                  Scripts that use this script
                                                                                                    Script Definition
                                                                                                    Script Steps
                                                                                                      Fields used in this script
                                                                                                        Scripts used in this script
                                                                                                          Layouts used in this script
                                                                                                            Tables used in this script
                                                                                                              Table occurrences used by this script
                                                                                                                Custom Functions used by this script
                                                                                                                  Custom menu set used by this script

                                                                                                                    Previous Script: [-] Next Script: [Open Website]
                                                                                                                    Script Name Load Saxon
                                                                                                                    Run script with full access privileges Off
                                                                                                                    Siri Shortcut Visible Off
                                                                                                                    Include In Menu Yes
                                                                                                                    Layouts that use this script
                                                                                                                      Scripts that use this script
                                                                                                                      Script Definition
                                                                                                                      Script Steps
                                                                                                                      • Set Variable [ $path; Value:"" ]
                                                                                                                      • #you may need to put in your path or have the libraries in the folder for the plugin
                                                                                                                      • If [ MBS("IsMacOS") ]
                                                                                                                      • Set Variable [ $path; Value:"libsaxonc-core-ee.12.10.0.dylib" ]
                                                                                                                      • Else If [ MBS("IsWindows") ]
                                                                                                                      • Set Variable [ $path; Value:"saxonc-core-ee.dll" ]
                                                                                                                      • Else If [ MBS("IsLinux") ]
                                                                                                                      • Set Variable [ $path; Value:"libsaxonc-core-ee.so.12.10.0" ]
                                                                                                                      • End If
                                                                                                                      • Set Variable [ $r; Value:MBS( "Saxon.Load"; $Path ) ]
                                                                                                                      • If [ MBS("IsError") ]
                                                                                                                      • Show Custom Dialog [ Title: "Failed to load saxon library."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                      • Halt Script
                                                                                                                      • End If
                                                                                                                      Fields used in this script
                                                                                                                        Scripts used in this script
                                                                                                                          Layouts used in this script
                                                                                                                            Tables used in this script
                                                                                                                              Table occurrences used by this script
                                                                                                                                Custom Functions used by this script
                                                                                                                                  Custom menu set used by this script

                                                                                                                                    Previous Script: [Load Saxon] Next Script: [-]
                                                                                                                                    Script Name Open Website
                                                                                                                                    Run script with full access privileges Off
                                                                                                                                    Siri Shortcut Visible Off
                                                                                                                                    Include In Menu Yes
                                                                                                                                    Layouts that use this script
                                                                                                                                    Scripts that use this script
                                                                                                                                      Script Definition
                                                                                                                                      Script Steps
                                                                                                                                      • #download the archive there and point us to xsl folder
                                                                                                                                      • Open URL [ "https://github.com/itplr-kosit/xrechnung-visualization/releases" ] [ No dialog ]
                                                                                                                                      Fields used in this script
                                                                                                                                        Scripts used in this script
                                                                                                                                          Layouts used in this script
                                                                                                                                            Tables used in this script
                                                                                                                                              Table occurrences used by this script
                                                                                                                                                Custom Functions used by this script
                                                                                                                                                  Custom menu set used by this script

                                                                                                                                                    Previous Script: [Open Website] Next Script: [Import PDF]
                                                                                                                                                    Script Name -
                                                                                                                                                    Run script with full access privileges Off
                                                                                                                                                    Siri Shortcut Visible Off
                                                                                                                                                    Include In Menu Yes
                                                                                                                                                    Layouts that use this script
                                                                                                                                                      Scripts that use this script
                                                                                                                                                        Script Definition
                                                                                                                                                        Script Steps
                                                                                                                                                          Fields used in this script
                                                                                                                                                            Scripts used in this script
                                                                                                                                                              Layouts used in this script
                                                                                                                                                                Tables used in this script
                                                                                                                                                                  Table occurrences used by this script
                                                                                                                                                                    Custom Functions used by this script
                                                                                                                                                                      Custom menu set used by this script

                                                                                                                                                                        Previous Script: [-] Next Script: [Import XML]
                                                                                                                                                                        Script Name Import PDF
                                                                                                                                                                        Run script with full access privileges Off
                                                                                                                                                                        Siri Shortcut Visible Off
                                                                                                                                                                        Include In Menu Yes
                                                                                                                                                                        Layouts that use this script
                                                                                                                                                                        Scripts that use this script
                                                                                                                                                                          Script Definition
                                                                                                                                                                          Script Steps
                                                                                                                                                                          • Perform Script [ “Clear” ]
                                                                                                                                                                          • Go to Field [ Saxon Visualize electronic Invoices::PDF ]
                                                                                                                                                                          • Insert File [ Saxon Visualize electronic Invoices::PDF ] [ Filters ] [ "PDF Files": ( *.pdf ) ] [ Storage method: Insert ] [ Display content ] [ Compression: Never compress ]
                                                                                                                                                                          Fields used in this script
                                                                                                                                                                          Scripts used in this script
                                                                                                                                                                          Layouts used in this script
                                                                                                                                                                            Tables used in this script
                                                                                                                                                                            Table occurrences used by this script
                                                                                                                                                                            Custom Functions used by this script
                                                                                                                                                                              Custom menu set used by this script

                                                                                                                                                                                Previous Script: [Import PDF] Next Script: [-]
                                                                                                                                                                                Script Name Import XML
                                                                                                                                                                                Run script with full access privileges Off
                                                                                                                                                                                Siri Shortcut Visible Off
                                                                                                                                                                                Include In Menu Yes
                                                                                                                                                                                Layouts that use this script
                                                                                                                                                                                Scripts that use this script
                                                                                                                                                                                  Script Definition
                                                                                                                                                                                  Script Steps
                                                                                                                                                                                  • Perform Script [ “Clear” ]
                                                                                                                                                                                  • Go to Field [ Saxon Visualize electronic Invoices::Invoice XML ]
                                                                                                                                                                                  • Insert File [ $file ] [ Filters ] [ "XML Files": ( *.xml ) ] [ Storage method: Insert ] [ Display content ] [ Compression: Never compress ]
                                                                                                                                                                                  • If [ Get(LastError) = 0 ]
                                                                                                                                                                                  • Set Field [ Saxon Visualize electronic Invoices::Invoice XML; MBS("Text.ReplaceNewline"; MBS("Container.GetText"; $file; "FILE"; "UTF-8"); 1) ]
                                                                                                                                                                                  • End If
                                                                                                                                                                                  Fields used in this script
                                                                                                                                                                                  Scripts used in this script
                                                                                                                                                                                  Layouts used in this script
                                                                                                                                                                                    Tables used in this script
                                                                                                                                                                                    Table occurrences used by this script
                                                                                                                                                                                    Custom Functions used by this script
                                                                                                                                                                                      Custom menu set used by this script

                                                                                                                                                                                        Previous Script: [Import XML] Next Script: [InitDynaPDF]
                                                                                                                                                                                        Script Name -
                                                                                                                                                                                        Run script with full access privileges Off
                                                                                                                                                                                        Siri Shortcut Visible Off
                                                                                                                                                                                        Include In Menu Yes
                                                                                                                                                                                        Layouts that use this script
                                                                                                                                                                                          Scripts that use this script
                                                                                                                                                                                            Script Definition
                                                                                                                                                                                            Script Steps
                                                                                                                                                                                              Fields used in this script
                                                                                                                                                                                                Scripts used in this script
                                                                                                                                                                                                  Layouts used in this script
                                                                                                                                                                                                    Tables used in this script
                                                                                                                                                                                                      Table occurrences used by this script
                                                                                                                                                                                                        Custom Functions used by this script
                                                                                                                                                                                                          Custom menu set used by this script

                                                                                                                                                                                                            Previous Script: [-] Next Script: [Extract XML]
                                                                                                                                                                                                            Script Name InitDynaPDF
                                                                                                                                                                                                            Run script with full access privileges Off
                                                                                                                                                                                                            Siri Shortcut Visible Off
                                                                                                                                                                                                            Include In Menu Yes
                                                                                                                                                                                                            Layouts that use this script
                                                                                                                                                                                                              Scripts that use this script
                                                                                                                                                                                                              Script Definition
                                                                                                                                                                                                              Script Steps
                                                                                                                                                                                                              • #Locate DynaPDF library
                                                                                                                                                                                                              • #you can have libraries in container and export at runtime to folder of your choice.
                                                                                                                                                                                                              • #Or install library somewhere and pass path.
                                                                                                                                                                                                              • #If library is in same folder as plugin, you can only pass only file name.
                                                                                                                                                                                                              • If [ MBS("IsServer") ]
                                                                                                                                                                                                              • #Put the path you use for your server here:
                                                                                                                                                                                                              • If [ Get(SystemPlatform) = -2 ]
                                                                                                                                                                                                              • #Server on Windows
                                                                                                                                                                                                              • Set Variable [ $path; Value:"C:\Programs\FileMaker Server\dynapdf.dll" ]
                                                                                                                                                                                                              • Else If [ MBS("IsLinux") ]
                                                                                                                                                                                                              • #Server on Linux for FileMaker Cloud
                                                                                                                                                                                                              • Set Variable [ $path; Value:"/opt/FileMaker/FileMaker Server/dynapdf.linux.so" ]
                                                                                                                                                                                                              • Else [ ]
                                                                                                                                                                                                              • #Server on Mac
                                                                                                                                                                                                              • Set Variable [ $path; Value: "/Library/FileMaker Server/dynapdf.dylib" ]
                                                                                                                                                                                                              • End If
                                                                                                                                                                                                              • Else [ ]
                                                                                                                                                                                                              • #For desktop and our examples we look in same folder as database:
                                                                                                                                                                                                              • Set Variable [ $databasePath; Value:Get(FilePath) ]
                                                                                                                                                                                                              • Set Variable [ $databasePath; Value:MBS("Path.FilemakerPathToNativePath"; $databasePath) ]
                                                                                                                                                                                                              • Set Variable [ $databasePath; Value:Substitute ( $databasePath ; ".fp7" ; ".fmp12") ]
                                                                                                                                                                                                              • Set Variable [ $databaseName; Value:Get(FileName) & ".fmp12" ]
                                                                                                                                                                                                              • If [ Get(SystemPlatform) = -2 ]
                                                                                                                                                                                                              • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dll" ) ]
                                                                                                                                                                                                              • #plugin will look for dynapdf.dll and if not found also for dynapdf.dll (64-bit) and dynapdf32.dll (32-bit).
                                                                                                                                                                                                              • Else [ ]
                                                                                                                                                                                                              • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dylib" ) ]
                                                                                                                                                                                                              • #Mac dylib is usually 32 and 64 bit together.
                                                                                                                                                                                                              • End If
                                                                                                                                                                                                              • #change folder to point to DynaPDF examples folder
                                                                                                                                                                                                              • Set Variable [ $path; Value:Substitute ( $path ; "/Saxon/"; "/DynaPDF/" ) // macOS ]
                                                                                                                                                                                                              • Set Variable [ $path; Value:Substitute ( $path ; "\Saxon\\"; "\DynaPDF\\" ) // Windows ]
                                                                                                                                                                                                              • End If
                                                                                                                                                                                                              • #You can test for free.
                                                                                                                                                                                                              • #If you like to get a dynapdf license, please follow links on our pricing page:
                                                                                                                                                                                                              • #https://www.monkeybreadsoftware.de/filemaker/pricing.shtml
                                                                                                                                                                                                              • Set Variable [ $LicenseKey; Value:"" // put your key here or leave empty for demo. // Use e.g. "Lite", "Pro" or "Starter" to use demo mode for just that mode. ]
                                                                                                                                                                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path; $LicenseKey) ]
                                                                                                                                                                                                              • If [ $r ≠ "OK" ]
                                                                                                                                                                                                              • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                                                                                                              • Halt Script
                                                                                                                                                                                                              • End If
                                                                                                                                                                                                              Fields used in this script
                                                                                                                                                                                                                Scripts used in this script
                                                                                                                                                                                                                  Layouts used in this script
                                                                                                                                                                                                                    Tables used in this script
                                                                                                                                                                                                                      Table occurrences used by this script
                                                                                                                                                                                                                        Custom Functions used by this script
                                                                                                                                                                                                                          Custom menu set used by this script

                                                                                                                                                                                                                            Previous Script: [InitDynaPDF]
                                                                                                                                                                                                                            Script Name Extract XML
                                                                                                                                                                                                                            Run script with full access privileges Off
                                                                                                                                                                                                                            Siri Shortcut Visible Off
                                                                                                                                                                                                                            Include In Menu Yes
                                                                                                                                                                                                                            Layouts that use this script
                                                                                                                                                                                                                              Scripts that use this script
                                                                                                                                                                                                                              Script Definition
                                                                                                                                                                                                                              Script Steps
                                                                                                                                                                                                                              • #Initialize DynaPDF if needed
                                                                                                                                                                                                                              • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                                                                                                                                              • Perform Script [ “InitDynaPDF” ]
                                                                                                                                                                                                                              • End If
                                                                                                                                                                                                                              • #Make new PDF environments. Lite license is needed
                                                                                                                                                                                                                              • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                                                                                                                                                              • #Load PDF from container
                                                                                                                                                                                                                              • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Saxon Visualize electronic Invoices::PDF) ]
                                                                                                                                                                                                                              • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf) ]
                                                                                                                                                                                                                              • Set Variable [ $FileCount; Value:MBS("DynaPDF.GetEmbeddedFileCount"; $pdf) ]
                                                                                                                                                                                                                              • If [ $FileCount > 0 ]
                                                                                                                                                                                                                              • Set Variable [ $index; Value:0 ]
                                                                                                                                                                                                                              • Loop [ Flush: Always ]
                                                                                                                                                                                                                              • #check file properties
                                                                                                                                                                                                                              • Set Variable [ $Name; Value:MBS( "DynaPDF.GetEmbeddedFile"; $pdf; $index; "Name") ]
                                                                                                                                                                                                                              • Set Variable [ $MimeType; Value:MBS( "DynaPDF.GetEmbeddedFile"; $pdf; $index; "MimeType") ]
                                                                                                                                                                                                                              • Set Variable [ $Description; Value:MBS( "DynaPDF.GetEmbeddedFile"; $pdf; $index; "Description") ]
                                                                                                                                                                                                                              • If [ $MimeType = "text/xml" ]
                                                                                                                                                                                                                              • Set Variable [ $Content; Value:MBS( "DynaPDF.GetEmbeddedFile"; $pdf; $index; "Content"; "UTF8") ]
                                                                                                                                                                                                                              • Set Variable [ $Content; Value:MBS( "Text.ReplaceNewline"; $Content; 1) // CR for line ending ]
                                                                                                                                                                                                                              • Set Field [ Saxon Visualize electronic Invoices::Invoice XML; $Content ]
                                                                                                                                                                                                                              • Exit Loop If [ 1 ]
                                                                                                                                                                                                                              • End If
                                                                                                                                                                                                                              • #next
                                                                                                                                                                                                                              • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                                                                                                                              • Exit Loop If [ $index = $FileCount ]
                                                                                                                                                                                                                              • End Loop
                                                                                                                                                                                                                              • Else [ ]
                                                                                                                                                                                                                              • Show Custom Dialog [ Message: "No embedded files."; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                                                                                                                              • End If
                                                                                                                                                                                                                              • #cleanup memory
                                                                                                                                                                                                                              • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                                                                                                                                                              Fields used in this script
                                                                                                                                                                                                                              Scripts used in this script
                                                                                                                                                                                                                              Layouts used in this script
                                                                                                                                                                                                                                Tables used in this script
                                                                                                                                                                                                                                Table occurrences used by this script
                                                                                                                                                                                                                                Custom Functions used by this script
                                                                                                                                                                                                                                  Custom menu set used by this script

                                                                                                                                                                                                                                    Download example: Saxon Visualize electronic Invoices

                                                                                                                                                                                                                                    Used functions: