Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

Excerpt

Computes the positive or negative sign of a given numeric value. The value can be a Decimal or a Decimal or Integer literal, a function returning Decimal or Integer, or a reference to a column containing numeric values. 

  • For positive values, this function returns returns 1. 
  • For negative values, this function returns returns -1.
  • For the value value 0, this function returns returns 0.

D s
snippetBasic

Column reference example:

D code

derive type:single value:SIGN(MyInteger) as:'sign_MyInteger'

Output: Generates Generates the new sign_MyInteger column containing the absolute value of each value found in the the MyInteger column. 

Numeric literal example:

D code

delete row:(SIGN(MyInteger) == -1)

Output: Deletes all rows from the dataset in which the sign of the entry in the the MyInteger column is -1. This transform remove all rows contain negative values in the the MyInteger column.

D s
snippetSyntax

D code

derive type:single value:SIGN(numeric_value)

ArgumentRequired?Data TypeDescription
numeric_valueYDecimal or Integer Decimal or Integer literal, function returning Decimal or Integer, or name of column to apply to the function

D s lang notes

numeric_value

...

  • Missing input values generate missing results.
  • Literal numeric values should not be quoted. Quoted values are treated as strings. 
  • Multiple columns and wildcards are not supported.

...

D code

case cases: [(signX == 1) && (signY == -1),'lower-right'],[(signX == 1) && (signY == 1),'upper-right'],[(signX == -1) && (signY == -1),'lower-left'],[(signX == -1) && (signY == 1),'upper-left'] default: 'line'  asas: 'quadrant'

Results:

XYsignXsignYquadrant
-24-11upper-left
-6.2-2-1-1lower-left
0-4.20-1line
4411upper-right
15-0.051-1lower-right

D s also
labelmath