The Scripted Export method is another way to deploy a widget to your custom app.
Clicking the "Scripted Export" button does all the work for you to create a script that will load the entire widget into a web viewer. It copies script steps to your clipboard and is ready for you to paste them into a script.
This method is a bit different than Scripted Rendering. Here, the code is exported to a local temporary folder. The web viewer object then reads the code from that local
Just a bit left to do
Once the steps are pasted into a script, you need to do a few things:
- Create a container field in a table (possibly a preference table). Reference it here in step 18.
- In line 55, use the same container field in the Export Field Contents script
- Add a web viewer object to the target layout. Name it "web" (as you see in step 12 of the above script).
- If you're using multiple widgets on the same layout and want them to display at the same time, simply rename one of the objects and use that name in the corresponding script.
- Adjust the Data variables
You may wish to remove all these variable-settings, including line 25 in the example above to a subscript. This subscript sets up the data object in $data and then passes it to this main script for use.
- In the example above, line 16 is using Insert Text to insert the sample data into the variable. Here, however, you want to write your own subscript that collects the data, returns it to this parent script and then sets the result inside the $data variable.
- Adjust any other variables
Using this Scripted Export script
This method of deployment is simple to use and is very versatile. It can be used for any widget, simple or complex. In this method, you're calling a script every time you want users to interact with the widget.
Here are some possibilities
- Call this script during a navigation script that goes to the layout with the web viewer object
- Place the web viewer object inside a popover, and then set the onObjectEnter script trigger to load the web viewer.