3 Replies Latest reply on Feb 1, 2011 9:47 AM by philmodjunk

    Create a Record from on File into Another File

    KAmsinger

      Title

      Create a Record from on File into Another File

      Post

      I am currently working FMP 10 Adv and have my database files setup on FMP Server 10 Adv which is on a server/network. 

      What we are waiting is through instant web publishing have a person go online and access our FMP file called Questionnaire. In the Questionnaire file they will only see 1 new record ready for them to fill out, they will Fill in the information on the Questionnaire and hit submit. When they hit submit the information they have entered into the fields will be synced up with our internal FMP file which is on the server called Database. And all the information they entered in will go into a new record with all their info in the correct fields. 

      I was wondering if anyone can explain to me how to set the two files up so:

      1.) the questionnaire file they are only allowed to see 1 new blank record to be filled in.

      2.) setup the scripting for the submit button to then transfer the information they have entered in to the 2nd FMP file called Database.

      3.) Then take all the information from all the fields in the Questionnaire File and have it show all the info in 1 field on the Database file called Registration form Field. 

        • 1. Re: Create a Record from on File into Another File
          philmodjunk

          1) If your questionaire table has an auto-entered serial number field, then this script could set up the layout for your user to start filling out the questionaire:

          Go to layout [//questionaire layout] //not needed if user is already on this layout
          New Record/Request
          Set Variable [$ID ; QuestionaireTable::SerialID]
          Enter Find Mode[]
          Set Field [QuestionaireTable::SerialID ; $ID ]
          Perform Find[]

          This script creates a new record and then isolates it in a found set of that one single record. Depending on how you set up your layout design for web publishing, you may not need to do anything but create the new record on this layout.

          2) This will happen automatically as the user is entering data into your database via their web browser once they fill out the form and submit it.

          3) A calculation can be devised to do this for you: Field1 & FIeld2 & ¶ & field3 & ...  (¶ is the symbol to use to start a new line of text in the field..) The same submit button that commits the questionaire responses can perform a script that uses set field to log this info or you can just define a calculation field in your questionaire table that does this.

          • 2. Re: Create a Record from on File into Another File
            KAmsinger

            So would this script be setup on the open script?

            Also how do I sync up the 2 files so the info entered into the Questionnaire file fills in on the Database file in a new record. Because they are literally 2 separate files so that "outside people" who are filling out the questionnaire can't access the the records in the Database file.

            do you have an example files w/ scripts that I could possibly use as a guide?

            I am using instant web publishing because I have tried everything in the book to get my Web Publishing engine to start on my server on the Admin console and have found no resolution and tried all the suggestions that I can find out there. Therefore, I can't do a custom webpage and have to use instant web publishing through a url that connects to my server.

            I really appreciate your help with all of this. I could send you raw files of what I have if that would help just tell me how I would send it to you.

            • 3. Re: Create a Record from on File into Another File
              philmodjunk

              So would this script be setup on the open script?

              Yes, if you want this to take place automatically each time a user accesses your database. Your alternative would be to place a button on the first layout that they see called "start questionaire" or some such label and set it up to run the sript.

              You should be able to design your web layouts and security settings so that web users can only see the record they have created and are filling out. That would eliminate the need for having a separate file. If you still decide to keep two tables for this. You can write a script in the second file that uses import records to import data from the web published file. A script in the web published file can perform the script in the second file. In that scenario, make sure you use the script I suggested eariler so that the current user has a found set of just their questionaire record so that only that record is imported.

              You can also set up batch imports that import all the data for a given date or date range instead of in a record by record basis.