March 14, 2022

With - XpressDox

This article follows on from the Set command article. The With command allows you to add a condition block around one or more Set commands, and apply the same conditions to those Set commands.

Conditions in Set commands:

By way of example, consider several Set commands which all need to apply if the Number_of_Shareholders > 3.

«Set(Ordinary_Resolution_Percentage,(Number_of_Shareholders > 3),75)»
«Set(Special_Resolution_Percentage,(Number_of_Shareholders > 3),85)»
«Set(Number_of_Members,((Number_of_Shareholders > 3)),5)»

 

Simplify the code using a With command:

The above could be simplified using a With command, especially if there are multiple conditions:

«With(Number_of_Shareholders > 3)»
  «Set(Ordinary_Resolution_Percentage,(),75)»
  «Set(Special_Resolution_Percentage,(),85)»
  «Set(Number_of_Members,(),5)»
«End()»

Now each Set command inherits the condition inside the With block. If there is also a condition inside the Set command, both conditions will be applied.

 

Note:

It is important to note that the With command is only used within the context of the Set command.