How do I use splash commands for bulk updates (data cleansing)

Splash commands can be thought of as a form of intelligent copy/paste.  The Splash commands can copy expressions or values instantaneously across entire datasets.

Note this is an introductory article covering most commonly syntax use only i.e. choose to splash ...

! the expression or the value in its original form
!* the expression or the value in its original form for all nodes in the view
!! the value rather than the expression
!d the expression or the value to descendants only
!*= the new value only where there is a match on the present values (see conditional …)

Advanced topics for Splash commands can be found in the Gizmo Cookbook

Standard Use of Splash

There are several variants of Splash command but all use ! symbol (bang/exclamation mark) to symbolise 'splash'.  These are the simplest variants:

  • Use ! ending to splash the expression or the value in its original form
  • Use !! ending to splash the value rather than the expression

By default, all Splash commands apply to filtered data only.

 

The following is a sequence demonstrating a basic use of Splash.  In this instance, the requirement is to merge multiple country-specific datsets into one, therefore I would filter to the country concerned, add a property 'country', the do a bulk update using !* where:

  • Use ! ending to splash the expression or the value in its original form
  • Add * to update all nodes in the "view" (filtered dataset)

  which results in:

The same Splash format is used to evaluate an expression, here everyone has a proposed salary increase of 5%:

 

  which results in:

However, note here that the expression although evaluated, is retained, because of the !* useage.

If using the alternate !!* format, it is the value of the expression that is splashed:

 

 

This hints at another alternate use of the splash command

....if an expression is accidentally overwritten by a hard value, it can be undone (restored to an expression) by the approach already outlined i.e. use the !* format

Below is another data cleansing example.  It is possible to identify a hierarchy associated with Finace department, but the department value is missing:

Splash with Ranges

 

In this case, there is a sampe use of descendants

  • Use ! ending to splash the expression or the value in its original form
  • Add d to update those nodes which are descendants of the selected cell

 

Other Splash 'switches' are available as with standard node navigation:

syntax explanation/selection
c child
s sibling
d descendant
* all nodes
a ignore filters

It is also possible to define ranges, i.e. define the levels copies down or up to, e.g. UK!d(0,-2) copies “UK” up to 2 levels above, or UK!d(0,2) copies “UK” down 2 levels.

Note that d(0) signifies all descendants including the present node: see this article for other possible examples

Advanced Topic: Conditional Logic

There is an additional form which includes = which works like a simplified if ... then ... statement

In the example below there are multiple formats of gender Female:

and I want to reset only those values incorrectly set to "female" to "Female".  Select one of the cells set to "female" and add 'Female!*=' 

then the cell value sets to Female only if the present value is female:

For example, five nodes with the following values for gender:

 

  1. Male
  2. Female
  3. female
  4. Male
  5. female

 

If I set node 3, which presently has the value female, to

Female!*

all nodes will get value Female.

If I set node 3, which presently has the value female, to

Female!*=

only nodes that currently have female will get new value Female.

Have more questions? Submit a request

Comments