Functions
/
Multipart Functions and Form Encoding

Multipart Functions and Form Encoding

When gathering the relevant information for a form to be used with an UPDATE, INSERT, or any other destructive call to a database or an API, it is important to eliminate anything that might get in the way of your data being pristine. To that end, utilizing multipart functions and form encoding can provide a bit more comfort to those charged with maintaining data integrity of frequently-used dat sources. Below, we'll describe how to assign those values within your Internal instance.

Input Encoding

One can fairly easily explicitly type inputs for a function in Internal.

  1. Create a new update-type (or any destructive type) function in Internal and assign a Data Source. Ensure that the "Set" required by the transaction form has all required fields associated, and that they've been assigned variables. [Note: primary keys do not require string interpolation (the "{ }"), but any optional items in the form set will require them.]
  1. Next, you'll switch, in the same view, to the "Inputs" tab

Note that the parameters set in this section are the same as those assigned variables in the "Set" section of the configuration menu.

  1. From this menu, you can select the encoding type for the form input. In this case, we've ensured that the input type for `$AddressID` must be an Integer.

Multipart Forms - Files as Inputs

FIle Object

In addition to text-based formats for form inputs, Internal supports file inputs. The first is more generic and only needs to be of type "file." To make use of this feature, create your input in the configuration menu, navigate to the "Inputs" tab, and select "File Object" as the "Type" for that input. A file uploader will then appear in the configuration menu under the "Configure" tab, as well as in the published form in your Space. This input will require a valid "file object" type.

Binary File Object

One can also use a binary file as the input type. This could be used as a way to pull application binaries from one server to another for deployment, or as a way to archive application binaries post CI/CD. One selects it like the would select "File Object." We have a whole section on Binary file types here.

JSON File Object

One can also pass a JSON object to the form and type the input in such a way that its format type is required for the form to be submitted to the server. JSON file format is electable in the same dropdown as the other file types.

Don't Forget to Test!

Internal's Function editor allows for quick access to test the output an outcomes of your function-writing. You can find the runner in the lower-lefthand side of the Function editor.