s (substitution)

s (substitution)


range Index Level substitution
Syntax s;attrnum1;attrnum2
s;'text';'text'
s;*;'text'  
Category Processing Codes
Type Processing Code
Description substitutes either a data value from the referenced attribute or literal text when the current data value is null or zero.

The "s" processing code returns the value defined by "attrnum2" if the value for conversion is null or zero. Otherwise, the value of "attrnum1" is returned.  "attrnum1" and "attrnum2" may both be an attribute number or text string.

The "*" is used to display the original data value, if it is not null or zero. Otherwise, the second argument is displayed.  This feature may be embedded within an "f" processing code in the form:  fattrnum(s;*;'text')  It also may be embedded within an "a" processing code.
Options
See Also u009e input-conversion processing codes a (algebraic) substitution Processing Codes
Example Substitution is used in an "a (algebraic)" processing code as an alternative to the THEN/ELSE construct.

The following A correlatives produce identical results:

aif n(sales)>="1000000" then "made it" else "trouble"

a(n(sales)>="1000000")(s;"made it";"trouble")

The following checks for the existance of a shipping address in attribute 20. If not there, show the billing address in attribute 10.

a(20)(S;*;10)
Warnings
Compatibility D3 7.0 AP
range Index Level substitution