0 Replies Latest reply on Aug 10, 2014 7:24 AM by dburnham

    How to modify iOS App Maker to pass only 1 variable

    dburnham

      In the iOS AppMaker, you have the ability to specify a script parameter and any number of variables. However, if you create a "mobileconfig" file that is intended to use only one of the variables you keep in the portal of variables, the generated mobileconfig file will automatically include in the URL all the variables that exist in your portal of variables.

       

      In my case, I am making a unique mobileconfig file for each person authorized to access a hosted database. The variable being used is the hardware serial number of the iPad, which exists in the person's database record. If there is not a match between the variable passed by the OnOpen script and the data record, the user is denied access.

       

      In order to make the iOS AppMaker sensitive to the need to include only one variable in the generated URL, the following modifications were made to my iOS AppMaker database:

      1. created a new table occurrence that isolates the desired variable. In my case, I am matching the script parameter to the value of my desired variable. You use case could be different.
      2. created one new field in the FILES table. I called my field "all_variables" and placed it on the layout as a checkbox using the value list called "True"
      3. modified the field URL in the FILES table as shown in the screen shot. The callculation text is repeated below.

       

      I also found it handy to modify the standard text of the outgoing email message to include a sentence that not only tells the recipient that the URL is unique for a specific user, but also makes it easier to know the contents of the mobileconfig file when reviewing the email message. The subject line can be modified the same way.

       

      Hope you find this helpful.

       

       

       

      modified URL calculation:

       

      //Handle local or remote file reference

      If (location="Remote";

      "FMP://"&GetAsURLEncoded(server)&"/"&GetAsURLEncoded(database);

      "FMP://%7E/"&GetAsURLEncoded(database)

      )

      //Add in the Scripting

      & If (Length(script)>0;

      (

      "?script="&GetAsURLEncoded(script) &

      If (Length(script_param)>0;

      "&param="&GetAsURLEncoded(script_param);

      "") &

       

      Case(

      //don't use multiple variables

      Count(FileVariables::encoded_variable)>1 and SelectedFile::all_variables ≠ 1;

      Substitute( FileVariable::encoded_variable ; ¶; "");

       

      //use multiple variables

      Count(FileVariables::encoded_variable)>1 and SelectedFile::all_variables = 1;

      Substitute( List( FileVariables::encoded_variable ) ; ¶; "");

       

      //only one variable exists

      Count(FileVariables::encoded_variable)=1 ;

      Substitute( FileVariable::encoded_variable ; ¶; "");

      "")

      );

      "")