3 Replies Latest reply on Jul 8, 2010 9:27 AM by philmodjunk

    exporting scripts code

    jaimeb82

      Title

      exporting scripts code

      Post

      I am stuck with this FM Pro database a consulting company build for our nonprofit organization. They builded a custom made import process for a type of program we run. When I run the Import I am missing the WorkPhone for every contact imported into the DB. I found out what's the script that makes the whole thing run, but is there a way I can copy/paste the code out of there to posted here in the future and see if someone can help me.

      I found out how to print the scripts, but I would like to copy them into note pad to have a text file with the code.

      Thanks,

      Jaime.

        • 1. Re: exporting scripts code
          philmodjunk

          Use the print option to print the script as a PDF. Open the PDF with acrobat reader and use the text tool to copy the script to your clipboard and now you can paste the script where you need to.

          If you have filemaker advanced it's easier as you can generate a database design report and copy scripts from the report.

          • 2. Re: exporting scripts code
            jaimeb82

            That work really well, I was able to print to PDF and from there copy/paste into Notepad. Thanks!

            The script that imports data into FM Pro 10 doesn't import workphone numbers, this is the code, since I don't have a debugger it is hard for me to figure out any problems, I've tryied modication here and there but nothing worked.

            Any answers or guide will help a lot.

            # # # Import Scripts # # #: Import - Update Contact
            Set Variable [ $contact; Value:SEMINARIMPORT::contact_id ]
            #Set address but check for dups
            Go to Layout [ “Utility: Seminar Import” (SEMINARIMPORT) ]
            Set Variable [ $address1; Value:SEMINARIMPORT::application_addr1 ]
            Set Variable [ $address2; Value:SEMINARIMPORT::application_addr2 ]
            Set Variable [ $city; Value:SEMINARIMPORT::application_city ]
            Set Variable [ $state; Value:SEMINARIMPORT::application_state ]
            Set Variable [ $zip; Value:SEMINARIMPORT::application_zip ]
            Set Variable [ $country; Value:SEMINARIMPORT::application_country ]
            Go to Layout [ “Utility: Address” (ADDRESS) ]
            Enter Find Mode [ ]
            Set Field [ ADDRESS::Address1; $address1 ]
            Set Field [ ADDRESS::Address2; $address2 ]
            Set Field [ ADDRESS::City; $city ]
            Set Field [ ADDRESS::State; $state ]
            Set Field [ ADDRESS::PostalCode; $zip ]
            Set Field [ ADDRESS::Country; $country ]
            Set Field [ ADDRESS::_fk_ContactID; $contact ]
            Perform Find [ ]
            If [ Get(FoundCount) = 0 ]
            New Record/Request
            Set Field [ ADDRESS::Address1; $address1 ]
            Set Field [ ADDRESS::Address2; $address2 ]
            Set Field [ ADDRESS::City; $city ]
            Set Field [ ADDRESS::State; $state ]
            Set Field [ ADDRESS::PostalCode; $zip ]
            Set Field [ ADDRESS::Country; $country ]
            Set Field [ ADDRESS::_fk_ContactID; $contact ]
            Set Field [ ADDRESS::Location; "Home" ]
            End If
            Go to Layout [ “Utility: Seminar Import” (SEMINARIMPORT) ]
            Set Variable [ $jname; Value:SEMINARIMPORT::application_jname ]
            Set Variable [ $address1; Value:SEMINARIMPORT::application_jadr1 ]
            Set Variable [ $address2; Value:SEMINARIMPORT::application_jadr2 ]
            Set Variable [ $city; Value:SEMINARIMPORT::application_jcity ]
            Set Variable [ $state; Value:SEMINARIMPORT::application_jstate ]
            Set Variable [ $zip; Value:SEMINARIMPORT::application_jzip ]
            Set Variable [ $country; Value:SEMINARIMPORT::application_jcountry ]
            Set Variable [ $schoolType; Value:SEMINARIMPORT::application_stype ]
            Go to Layout [ “Utility: Address” (ADDRESS) ]
            Enter Find Mode [ ]
            Set Field [ ADDRESS::Address1; $address1 ]
            Set Field [ ADDRESS::Address2; $address2 ]
            Set Field [ ADDRESS::City; $city ]
            Set Field [ ADDRESS::State; $state ]
            Set Field [ ADDRESS::PostalCode; $zip ]
            Set Field [ ADDRESS::Country; $country ]
            Set Field [ ADDRESS::_fk_ContactID; $contact ]
            Perform Find [ ]
            If [ Get(FoundCount) = 0 ]
            New Record/Request
            Set Field [ ADDRESS::Affiliation; $jname ]
            Set Field [ ADDRESS::Address1; $address1 ]
            Set Field [ ADDRESS::Address2; $address2 ]
            Set Field [ ADDRESS::City; $city ]
            Set Field [ ADDRESS::State; $state ]
            Set Field [ ADDRESS::PostalCode; $zip ]
            Set Field [ ADDRESS::Country; $country ]
            Set Field [ ADDRESS::_fk_ContactID; $contact ]
            Set Field [ ADDRESS::Location; "Work" ]
            Set Field [ ADDRESS::SchoolType; $schoolType ]
            End If
            #Set Phone/Email but check for dups
            Go to Layout [ “Utility: Seminar Import” (SEMINARIMPORT) ]
            Set Variable [ $phone; Value:SEMINARIMPORT::application_homephone ]
            Set Variable [ $email; Value:SEMINARIMPORT::application_email ]
            Go to Layout [ “Utility: Number” (NUMBER) ]
            Enter Find Mode [ ]
            Set Field [ NUMBER::PhoneEmail; $phone ]
            Set Field [ NUMBER::_fk_ContactID; $contact ]
            Perform Find [ ]
            If [ Get(FoundCount) = 0 ]
            New Record/Request
            Set Field [ NUMBER::_fk_ContactID; $contact ]
            Set Field [ NUMBER::PhoneEmail; $phone ]
            Set Field [ NUMBER::Description; "Home" ]
            End If
            Enter Find Mode [ ]
            Set Field [ NUMBER::PhoneEmail; Substitute ( $email ; "@" ; "\@" ) ]
            Set Field [ NUMBER::_fk_ContactID; $contact ]
            Perform Find [ ]
            If [ Get(FoundCount) = 0 ]
            New Record/Request
            Set Field [ NUMBER::_fk_ContactID; $contact ]
            Set Field [ NUMBER::PhoneEmail; $email ]
            Set Field [ NUMBER::Description; "Email" ]
            End If
            #Set the related fields
            Go to Layout [ “Utility: Seminar Import” (SEMINARIMPORT) ]
            Set Field [ seminarimport_CONTACT|ContactID::NameFirst;

            SEMINARIMPORT::application_firstname ]
            Set Field [ seminarimport_CONTACT|ContactID::NameLast;

            SEMINARIMPORT::application_lastname ]
            Set Field [ seminarimport_CONTACT|ContactID::NameMiddle;

            SEMINARIMPORT::application_middleinitial ]

            # Set Person Type. 2/11/10, CAW
            Set Field [ seminarimport_number_contact_PERSONTYPE|ContactID::PersonType;

            SEMINARIMPORT::application_persontype ]
            Set Field [ seminarimport_number_contact_PERSONTYPE|ContactID::f_Prim; "1" ]
            #Set the seminar choices
            Go to Layout [ “Utility: Seminar Import” (SEMINARIMPORT) ]
            Set Variable [ $choice1; Value:SEMINARIMPORT::seminar_code1 ]
            Set Variable [ $choice2; Value:SEMINARIMPORT::seminar_code2 ]
            Set Variable [ $choice3; Value:SEMINARIMPORT::seminar_code3 ]
            Set Variable [ $choice4; Value:SEMINARIMPORT::seminar_code4 ]
            Set Variable [ $title1; Value:SEMINARIMPORT::seminar_title1 ]
            Set Variable [ $title2; Value:SEMINARIMPORT::seminar_title2 ]
            Set Variable [ $title3; Value:SEMINARIMPORT::seminar_title3 ]
            Set Variable [ $title4; Value:SEMINARIMPORT::seminar_title4 ]
            Set Variable [ $start1; Value:SEMINARIMPORT::seminar_start_date1 ]
            Set Variable [ $start2; Value:SEMINARIMPORT::seminar_start_date2 ]
            Set Variable [ $start3; Value:SEMINARIMPORT::seminar_start_date3 ]
            Set Variable [ $start4; Value:SEMINARIMPORT::seminar_start_date4 ]
            Set Variable [ $end1; Value:SEMINARIMPORT::seminar_end_date1 ]
            Set Variable [ $end2; Value:SEMINARIMPORT::seminar_end_date2 ]
            Set Variable [ $end3; Value:SEMINARIMPORT::seminar_end_date3 ]
            Set Variable [ $end4; Value:SEMINARIMPORT::seminar_end_date4 ]
            Go to Layout [ “Utility: Seminar Join Contact” (SEMINARJOIN) ]
            New Record/Request
            Set Field [ SEMINARJOIN::_fk_ContactID; $contact ]
            Set Field [ SEMINARJOIN::Choice; 1 ]
            Set Field [ SEMINARJOIN::_fk_SeminarCode; $choice1 ]
            Set Field [ SEMINARJOIN::Status; "Applied" ]
            New Record/Request
            Set Field [ SEMINARJOIN::_fk_ContactID; $contact ]
            Set Field [ SEMINARJOIN::Choice; 2 ]
            Set Field [ SEMINARJOIN::_fk_SeminarCode; $choice2 ]
            Set Field [ SEMINARJOIN::Status; "Applied" ]
            New Record/Request
            Set Field [ SEMINARJOIN::_fk_ContactID; $contact ]
            Set Field [ SEMINARJOIN::Choice; 3 ]
            Set Field [ SEMINARJOIN::_fk_SeminarCode; $choice3 ]
            Set Field [ SEMINARJOIN::Status; "Applied" ]
            New Record/Request
            Set Field [ SEMINARJOIN::_fk_ContactID; $contact ]
            Set Field [ SEMINARJOIN::Choice; 4 ]
            Set Field [ SEMINARJOIN::_fk_SeminarCode; $choice4 ]
            Set Field [ SEMINARJOIN::Status; "Applied" ]
            #Back
            Go to Layout [ “Processing ...” (SEMINARIMPORT) ]

            • 3. Re: exporting scripts code
              philmodjunk

              Since you don't have advanced (The debugger alone is well worth the extra $$ it costs), You can insert The following pair of script steps at strategic places to check values and what layout and record is current at those points:

              Refresh Window
              Show Custom Dialog[//list variable and use literal text field names here to show their values]

              That pauses the script so you can see what is current and check the dialog that pop's up to see specified values. I'd put those steps just before any line where you refer to a phone number field.