Data

The Data option in WidgetStudio is vital for many widgets. These options are where the required values can be generated via a script or calculation in your custom app after embedding or rendering / exporting via a script. These options can also be hardcoded in WidgetStudio and used during the deployment.

In this example, there are six options that are defined as Data. Some of these data options are simple text fields, and one is a complex JSON Array. In fact, any one of these options can be defined as data by the developer and thus have its values generated.

What Can be Data

Any of the options exposed by the author can be data options. The widget can have data options that are

Data Options that Make Sense

In most cases, the author of the widget defined certain options to be the data ones. In the example above, the data options have to do with the data being displayed on the graph. Other fields are hardcoded in WidgetStudio. In this case, you can customize the colors for each data series.

Make More Options be Data

The author of the widget has identified the data options she feels is most useful, but there are times when you want to make more of the options be programmable by scripting or variables

For example, this widget contains many data fields, but the Chart Type option is hardcoded to be "bar". Thus, when deployed to a widget, this graph will only be a bar graph.


Without diving into the backend code of this, you can simply check a box to make it a data option

To do so, click the button at the bottom left with the f on it. 

Or, in the File Menu, click "Toggle Deploy Option Management"

This opens up a subtle panel upon which you can mark (or unmark) options as data.

Checking any row will make that option a data option, and thus programmable by FileMaker scripting or variable declaration (see Deploying a Widget for more details).

Unchecking any row will remove its data option functionality and will keep the value here hardcoded in the widget.

Complex Data Options

Most widgets require some complex structure for the values to be presented. In the above example, a JSON Array is used because that is what is required for the widget to display the data on the graph.

Generating Complex Data

This data option can be hardcoded here, but more useful, it will be generated in some way when you deploy this widget. You can read more about that in these three deployment methods in FileMaker, using the platform's native JSON functions.

Read the following documentation to learn more.

JSON Errors

As you go about testing this widget prior to deployment, you may produce errors in the JSON. WidgetStudio will alert you to this fact and suggest the errors.


Here, an indicator lets you know there's an error in this JSON

On viewing the JSON, the red X shows where the error is.

It is a good idea, before manipulating the JSON, to copy and paste this text somewhere else, and then use it to restore if you run into big issues.