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

...

Column reference example:

SIGN
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
sign(MyInteger) as:'sign_MyInteger'

sign(MyInteger)

Output:

...

Returns the

...

sign

...

of the value found in the MyInteger column.

Numeric literal example:

SIGN
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextdelete row:(
sign(MyInteger) == -1)

...

(sign(MyInteger) == -1)

Output: Returns true if the sign of the entry in the MyInteger column is -1.

...

 

D s
snippetSyntax

SIGN
d-codelang-syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:
sign(numeric_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

...

XY
-24
-6.2-2
0-4.2
44
15-0.05

TransformTransformation:

You can use the following transform to derive the sign values of these columns:

d-

...

trans
RawWrangletrue
p03Value'signX'
Typestep
WrangleTextderive type:single value:

...

sign(X) as: 'signX'

...

p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valuesign(X)
p03NameNew column name
SearchTermNew formula

D trans
RawWrangletrue
p03Value'signY'
Typestep
WrangleTextderive type:single value:

...

sign(Y) as: 'signY'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valuesign(Y)
p03NameNew column name
SearchTermNew formula

Using these two columns, you can assign each set of coordinates into a quadrant. For ease of reading, the following has been broken into two separate tranformations:

d-

...

trans
RawWrangletrue
p03Value'lower-right'
p06NameDefault value
WrangleTextcase cases: [(signX == 1) && (signY == -1),'lower-right'],[(signX == 1) && (signY == 1),'upper-right']

...

default: 'line' as: 'q1'
p01NameCondition type
p06Value'line'
p03NameCase 01 - Value
p07Value'q1'
p04Value(signX == 1) && (signY == 1)
SearchTermConditional column
p07NameNew column name
Typestep
p05NameCase 02 - Value
p01ValueCase on custom conditions
p02NameCase 01 - Condition
p02Value(signX == 1) && (signY == -1)
p05Value'upper-right'
p04NameCase 02 - Condition

D trans
RawWrangletrue
p03Value'lower-left'
p06NameDefault value
WrangleTextcase cases: [(signX == -1) && (signY == -1),'lower-left'],[(signX == -1) && (signY == 1),'upper-left'] default: 'line' as: 'q2'
p01NameCondition type
p06Value'line'
p03NameCase 01 - Value
p07Value'q2'
p04Value(signX == -1) && (signY == 1)
SearchTermConditional column
p07NameNew column name
Typestep
p05NameCase 02 - Value
p01ValueCase on custom conditions
p02NameCase 01 - Condition
p02Value(signX == -1) && (signY == -1)
p05Value'upper-left'
p04NameCase 02 - Condition

Then, you can merge the two columns together:

D trans
RawWrangletrue
p03Value'quadrant'
Typestep
WrangleTextmerge col:q1,q2 as:'quadrant'
p01NameColumns
p01Valueq1,q2
p02NameSeparator
p02Value''
p03NameNew column name
SearchTermMerge columns

Results:

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

...