How do I troubleshoot expressions

This is intended to be a simplified self-help guide for troubleshooting common problems with expressions.  There is limited cover of specific expressions - the full guide can be found in the Gizmo Cookbook Note that this is not intended to replace the debug section in that guide, it is intended as a quick start approach only

 

Common Problem: .sum does not calculate

To successfully run expressions based on numbers, the referenced underlying property values must be numeric

For calculations to work all dependent elements and the calculated property itself must be type number - any that are type text or if the underlying values are text that would need to be corrected for the calculation to succeed.

While in the vast majority of cases formatting of number in Excel will not impact OrgVue, some explicit formatting in Excel may not be translated into Excel.

One clue is decimal places as shown in OrgVue 0, 3, 4, 5 e.g.

0
123.456
123.4567
123.45678

but when you set the 'number mask' in the OrgVue number property this will always show consistently across all cells e.g. if the number format is shown as 4 decimal places (in OrgVue) , even zero will show as

0.0000

So the inconsistency of presentation would point to these being interpretted as text (in OrgVue).

Note text colums will typically left-align while numbers will right-align so if the values are left-aligned the quickest fix is to review the content in Excel, if possible, before pasting into OrgVue.

Another quick check on type is associated icons: folder is text and book is number, for instance.

 

icons.png

Common Problem: after adding an expression, dataset runs slowly or does not open at all

Symptoms:

  • Cannot get dataset to display on opening:the loading bar says “Evaluate expressions XXX of XXXX MB”.
  • Error message 1009 shows on open - note this could just be transient, or a Flash memory problem

In the first instance, try opening OrgVue in safe mode. In this mode, expressions are not evaluated, so if expressions are the problem (which is likely) a marked performance difference will be seen.

https://orgvue2.concentra.co.uk/?safemode=on

There is no ready mechanism to determine which expressions are taking a long time to load but the recommendation in the first instance would be to review those that contain nodes() or node.d

It is possible to identify evaluated properties: these can be found by using isevaluated:true as a search option in the left hand property pane

Once you have identified candidate expressions that may be at fault, you can test them one by one using the Expression Manager.

 

Common Problem: expression too complex to debug

OrgVue typically applies cumulative operations on subsets of data - which you need to identify and build - rather than applying a single operation on all data - see section "Gizmo expressions are written differently to other functions" in this article

... so use the Expression Manager to check individual elements work as expected before testing the whole

  • e.g. starting with:
node.d.filter(n=>n.department.value == "Finance").totalannualcompensation.sum
  • The following expression element will generate a list of descendant nodes
node.d
  • The following expression elements will generate a list of filtered descendant nodes, those with department property value "Finance" only
node.d.filter(n=>n.department.value == "Finance")
  • The following expression elements will generate a list of the value of "total compensation" property for descendant nodes which have department "Finance"
node.d.filter(n=>n.department.value == "Finance").totalannualcompensation
  • (Finally) The following expression elements will generate the total sum of all values of "total compensation" property for those descendant nodes which have department "Finance"
node.d.filter(n=>n.department.value == "Finance").totalannualcompensation.sum

 

 

 

 

 

Have more questions? Submit a request

Comments