# Frame node

(New to Analytica 6.0)

## Basic functionality

A Frame node is a rectangular space in a diagram that can show a table or graph for any user input or out node or other variable node that you click in ACP. In this way, a Frame makes it possible to view the table or graph for any node without having to allocate separate screen space for each one. So it is a convnient and efficient way to make a lot of information available to the user without having to create a lot of separate diagrams (or tabs). If the value of a user input or output is a single number or text value, it shows it in the node itself. If a user input contains an editable table, it shows the editable table in the Frame node. If a node contains a result table or graph, it shows that in the Frame.

A common UI layout that is used with frame nodes is to have the user inputs and user outputs aligned along the left edge of the diagram, with the frame node on the right, as illustrated here:

You can include more than one Frame node in a Diagram if you want to show more than one table or at a time. If you have two Frame nodes, it alternates which one it uses, so that it shows the two nodes that you clicked most recently. If you have more than two, it reuses the Frame that was updated the longest time ago -- leaving the most recently clicked ones showing.

In this example, the button style in the Diagram Style dialog is set to Icon, so a calc button appears as instead of , etc. When you press the calc button for Emissions by plan, the result graph for that variable appears in the frame node.

When you then click the edit table button for Driver scenarios, its edit table appears in the frame node.

At each step, the frame node displays the most recently selected edit table or result. By reusing screen real estate in this way, it makes for a favorable user experience, especially when using a model in a web browser via ACP.

## Two or more frame nodes

When you place two (or more) frame nodes on the same diagram, as shown here

then the content alternates between them as you press input or output buttons.

## Creating a Frame node

To create a frame node (in desktop Analytica), first drag a text node to the diagram, then change its class to Frame node. You can do this in the Object window for the node

or in the attribute pane with the node selected

After creating the node, make sure you resize it to be large enough to hold tables and graphs.

You'll also need to include some User input nodes or User output nodes on the same diagram, so that the user can select content. (Or, alternatively, you can control what appears using your own OnClick, OnChange or OnGraphClick code -- see #Scripting a Frame Node below.

Once you've created the frame node(s), the content will automatically appear in the frame node when you play your model in ACP. In desktop Analytica (as of Analytica 6.0), the content does not appear directly in the frame node by default, but edit table or result windows open directly over the frame node, which roughly simulates the ACP experience.

Side note: In desktop Analytica, the embed bit of the NodeInfo attribute controls whether content appears directly in frame nodes (as it also does in tall User input nodes and tall User output nodes). This bit is off by default in Analytica 6.0 due to the fact that the feature is still glitchy with some missing functionality in desktop editions. To turn on direct embedding in desktop Analytica, set the 11th field (the embed bit) of NodeInfo for the frame node object (if you want this to apply only to the one frame node), or in the NodeInfo for the FrameNode class object (if you want it to apply to all frame nodes in the model). To do this, open the Typescript window and view the current value:

> NodeInfo of FrameNode
1,0,0,0,,,,,,,,,0

Then copy that value, changing the 11th field to 1:

> NodeInfo of FrameNode : 1,0,0,0,,,,,,,1,,0

This will alter the behavior in desktop Analytica, but not in ACP. If you find this to be too glitchy with the current Analytica release, reset the attribute to its original value (i.e., clear the 11th field).

## Select what to display in a Frame

Normally, when you click a user input containing an Edit table, the table appears in a Frame node (if there is one). And if you click on a user output or any node in an influence diagram that is an array, it computes and shows the result as a table or graph, in the form it was last saved. You can toggle between table and graph view. If the quantity is uncertain, you can use the Uncertainty view menu to change between mid, mean, PDF, and other views.

Occasionally, you may want to control which view to display using a script. You can do that by setting an object handle and view type to the Att_FrameNodeShowing attribute of a frame node. It may be unset -- i.e., Null, with nothing displayed in the frame, or contain a 1-D array with system index Sys_FrameNodeShowIdx with 4 elements:

• «obj»: A handle to the variable in the view.
• «view»: The type of view, with options:
• 'DFNM': Show edit table
• 'DEFA': Show the default result view (as saved with result window)
• 'MIDM': Show the mid-value
• 'MEAN': Show the mean
• 'STAT': Show the statistics view
• 'CONF': Show the probability bands
• 'CDFP': Show the cumulative probability view
• 'PDFP': Show the probability density or probability mass view
• 'XCDZ': Show the exceedance probability view
• 'SAMP': Show the sample view
• 'SMPL': Show the sample view, even if if is non-probabilistic
• 'OBJV': Show the object window view. This case is not currently available in desktop Analytica.
• 'DIAG': Show the diagram (in which case, «obj» should be a handle to a module). This case is not yet fully functional in ACP and isn't available in desktop Analytica.
• «graph»: Set to 1 to display a graph result view, 0 for table, or Null to use the saved result window state. Ignored for edit tables, object views or diagrams.
• «computed»: 1 when result has already been computed (or results in an error), 0 when not yet computed, or Null when its state is not relevant or unknown. When setting from an event handler, you should usually set this to Null.

You can set this attribute to control what to display in a Frame node from within OnClick code (e.g., in a button), OnChange code (e.g., in a Choice input) or OnGraphClick code (e.g., drill down by selecting a datum in a graph). You can even set it to show a result for a variable that does not appear in the same diagram.

An example of code that might appear in an OnClick event, to show the result PDF graph for the variable Net_emissions would be:

Att_FrameNodeShowing of MyFrameNode:= Array( Sys_FrameNodeShowIdx,[ Handle(Net_emissions), 'PDFP', 1, Null ])

In a Choice node, where each selection is a handle to an input table, you could select which table you are currently editing by setting its OnChange expression to

Att_FrameNodeShowing of MyFrameNode:= Array( Sys_FrameNodeShowIdx,[ Self, 'DFNM', Null, Null ] )

### Configuring to show something at model load time

New to Analytica 6.3

You can set the attribute Att_ShowInitially of a FrameNode, using the same data structure described in the previous section for the Att_FrameNodeShowing attribute. When the model is first loaded, the content of is Att_ShowInitially automatically transferred to Att_FrameNodeShowing.

Alternatively, you can configure a button's OnClick to set Att_FrameNodeShowing, and from the button's context menu, set it to "Run at load time". This works in releases prior to Analytica 6.3.