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 r0761

D toc

Excerpt

Tests whether a set of values is valid for a specified data type and is not a null value.

  • For a specified data type and set of values, this function returns  true  or  false
  • Inputs can be literal values or column references.

You can use the ISVALID  function keywords interchangeably.

  • You can define a conditional test in a single step for valid values. See IFVALID Function.
  • This function is similar to the ISMISMATCHED function, which tests for mismatches against a specified data type. However, the ISMISMATCHED function also matches against missing values, while the ISVALID function does not. See ISMISMATCHED Function.

D s lang vs sql

D s
snippetBasic

Column reference example:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:(isvalid(Qty, 'Integer') && (Qty > 0))

(isvalid(Qty, 'Integer') && (Qty > 0))

Output: Returns true when the value in the Qty column contains a valid Integer and the value is greater than zero. 

Column reference example for Datetime:


The Datetime data type requires a special formatting string as part of the evaluation of validity:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:(isvalid(myDates,

(isvalid(myDates, ['Datetime', 'yy-mm-dd hh:mm:ss','yyyy*mm*dd*HH:MM:SSX']))

Output: Returns true when the value in the myDates column conforms to either of the following date format strings:

Code Block
yy-mm-dd hh:mm:ss
yyyy*mm*dd*HH:MM:SSX

For more information on these and other date format strings:

Numeric literal example:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value: isvalid('ZZ', 'State')

isvalid('ZZ', 'State')

Output: Returns false, since the value ZZ is not a valid U.S. State code.

D s
snippetSyntax

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:isvalid(column_string,datatype_literal)

isvalid(column_string,datatype_literal)


ArgumentRequired?Data TypeDescription
column_stringYstringName of column or string literal to be applied to the function
datatype_literalYstringString literal that identifies the data type against which to validate the source values

D s lang notes

column_string

Name of the column or string literal to be evaluated for validity.

  • Missing literals or column values generate missing string results.
    • Constants must be quoted ('Hello, World').
  • Multiple columns and wildcards are not supported.

D s
snippetusage

Required?Data TypeExample Value
YesString literal or column referencemyColumn

datatype_literal

Literal value for data type to which to match the source column or string. For more information, see Valid Data Type Strings.

  • Column references are not supported.

D s
snippetusage

Required?Data TypeExample Value
YesString literal'Integer'

Valid data type strings:

Include Page
Valid Data Type Strings
Valid Data Type Strings

D s
snippetExamples

Example - Type check functions

Include Page
EXAMPLE - Type Functions
EXAMPLE - Type Functions

D s also
labeltype