Altair® Panopticon

 

Parameterization with MongoDB Query Documents

The MongoDB Panopticon Designer (Desktop) connector supports the ability to insert Panopticon Designer (Desktop) parameters into a text-based query. The standard curly braces ( “{ }” ) are used to surround the parameter name and upon evaluation of the query it is replaced with the desired text. This feature is commonly used when creating dashboard components to control a visualization without having to return to plugin’s settings dialog.

  • Valid Text Query:

{ employee: ”Bob” }

  • Valid Text Query (with Parameters):

Assume we’ve defined parameters field and workerName in Panopticon Designer (Desktop) and given them the default values of:

field = employee

workerName = Bob

Then the above query could be written as:

{ {field} : “{workerName}” }

{ employee : “{workerName}” }

{ {field} : “Bob” }

  • Invalid Text Query (with Parameters):

Parameters:

field = employee

workerName = Bob

Statement:

{ {field} : {Bob} }

Do not use values in a statement. This cannot be interpreted and will generate an error.

Parameters:

field = employee

workerName = “Bob”

Statement:

{ {field} : “{ workerName }” }

Watch for duplication of special characters like double and single quotes.

  • Valid Numeric Query:

{ salary : { $gt : 30000 } }

  • Valid Numeric Query (with Parameters):

NOTE: Panopticon Designer (Desktop) cannot currently interpret the $ character within a parameter value. This causes unstable behavior in visualizations.

Example:

Assume we’ve defined parameters operator and amount in Panopticon Designer (Desktop) and given them the default values of:

operator = gt

amount = 30000

Then the above query could be written as:

{ salary : { ${operator} : {amount} } }

{ salary : { $gt : {amount} } }

{ salary : { ${operator} : 30000 } }

  • Invalid Numeric Query (with Parameters):

Parameters:

operator = $gt

amount= 30000

Statement:

{ salary : { {operator} : {amount} } }

The operator parameter is not valid here as it contains the ‘$’ character.