Form Development Assignments - Solutions
Solution 1 - Create Notification Form
Section titled “Solution 1 - Create Notification Form”Similar to the Computer Inspection form, create a new form. For building the form you have to decide how you want to layout the form. If you just need a simple vertical layout you can drag and drop fields directly into the form. If you need a more detailed layout add the columns layout and then align the fields however you desire.
For all fields adjust the Label and API property key to the desired values. Under validation set the Required field to indicate mandatory. You need to drag and drop the following:
- A
Selectfor the Notification types. Change the data and add some values that will be displayed in the form. - A
Textfieldfor Equipment Id. - Another
Textfieldto indicate Functional Location. - Finally a
Textareato accept the shorttext for the notification.
Click on Save and enter the title as Notification and set the description to a suitable one. You can now publish it and assign it to appropriate teams to use it.
If you want it to be more meaningful, think of all the data you would want to collect for your notification and add them like location, pictures etc.
Solution 2 - Inventory Master Data
Section titled “Solution 2 - Inventory Master Data”Similar to the Equipment master data, click on Create and choose the Master Data option.
For all fields adjust the Label and API property key to the desired values. Under validation set the Required field to indicate mandatory. You need to drag and drop the following:
- A
Textfieldfor the Equipment Id. Remember to set the Unique property as this is the key field of the Inventory master data. - A
Numberfor Inventory.
Click on Save and enter the title as Equipment Inventory and a suitable description. Finally save it.
Solution 3 - Personnel Master Data
Section titled “Solution 3 - Personnel Master Data”Similar to the Inventory master data above, click on Create and choose the Master Data option.
For all fields adjust the Label and API property key to the desired values. Under validation set the Required field to indicate mandatory. You need to drag and drop the following:
- A
Textfieldfor the Personnel Number. Remember to set the Unique property as this is the key field of the Inventory master data. - Another
Textfieldfor Name. - Add a
Phone Numberfield for Phone. Adjust the phone number mask based on what you require, the default is US number. - Add a
Textfieldfor Designation. You can also use aSelectfield and enter values to select. - Add a
Textfieldfor Organization. You can also use aSelectfield and enter values to select.
Click on Save and enter the title as Personnel and a suitable description. Finally save it.
Solution 4 - Dependent Master Data for Equipment and Functional Location
Section titled “Solution 4 - Dependent Master Data for Equipment and Functional Location”Equipment Master Data changes
Section titled “Equipment Master Data changes”- Click on the
Equipmentmaster data form and open the designer view. - Drag and drop a
Textfieldand change the label to Location. Click on the button to set the API Key also to location. To avoid data issues we will not mark this as a required field as we already have equipment entered without a location. - Save and Publish it.
- Now click on the
Dataicon in the Equipments row. In the data view, add a few more Equipment and Location info. You can also edit the existing Equipment and update their location.
Inspection Form changes
Section titled “Inspection Form changes”- We need to add some scripting to the
Locationcomponent to achieve the location update. - Open the properties for
Locationby clicking on the :fontawesome-solid-gear: icon - Navigate to the
Datatab and scroll down to theCalculated Valuesection and expand it. - This section can be used whenever a particular component needs to have a value that is not directly available but needs to be calculated. You also have access to all the properties of the component and in addition to all the data that the user has entered so far.
- Here is what we are going to do:
- Any Select component that is associated with a Master Data will always have a JSON attribute called
masterdaata. - We first need to find the
equipmentcomponent. Then we need to loop through the masterdata to identify the entry that has been selected - Using the selected master data we will retrieve the
locationand update the form data’s location attribute to that value - Finally we need to set a variable called
valueto the location desired. - This nifty trick will be achieved with the below JavaScript code
// Set to empty in case location is not set or not foundvalue = "";// Find the equipment component so the underlying masterdata can be usedutils.findComponent(form.components, "equipment", null, (comp) => {// Search through component.masterdata to find matching locationmd = comp.hasOwnProperty('masterdata') ? comp.masterdata : [];for (i = 0; i < md.length; i++) {if (md[i].equipmentId === data.equipment) {value = md[i].hasOwnProperty('location') ? md[i].location : "";break;}}});- Copy / paste the above code into the
Calculated ValueJavaScript box and Save. - Save the form and test it in the Preview or in the Turbo Forms App. Remember to publish the form before testing in the app.
- Any Select component that is associated with a Master Data will always have a JSON attribute called