DQ.TOKEN Function

Obtains a token name for the index from a parse or extract function.

Category: Data Quality
Returned data type: Character
Note: This function returns true on success and false if the index is out of range. The token name is returned in the second parameter from the parse or extract function.

Syntax

DQ.TOKEN(integer, string)

Required Arguments

integer

the index of the token for which the name is desired.

string

the output string that receives the token name.

Details

The DQ.TOKEN function is used to retrieve an extraction or parse token name for the index. This function follows a parse or extract function.

Examples

Example 1

data quality dq
string output
integer o
integer i
 
/* Initialize DQ */
dq = dq_initialize()
dq.loadqkb("EN")
 
/* Extract using the "Product Attributes" Extraction definition (using QKB PD 2012A) */
o = dq.extract("Product Attributes", "DOOR RANCHERO WOOD 16X8 WHT")
 
/* print all of the tokens we got */
print (o & " tokens filled")
for i = 1 to o
begin
     dq.token(i, output)
     print ("token #" & i & " = " & output)
     dq.value(i, output)
     print ("value #" & i & " = " & output)
end
/* to get a token's value by its name... */
dq.tokenvalue("Colors", output)
print ("Colors = " & output)

Example 2

/* Parse (using QKB CI 2013A) */
o = dq.parse("Name", "Mr. John Q Public Sr")
 
/* print all of the tokens available */
print (o & " tokens filled")
for i = 1 to o
begin
     dq.token(i, output)
     print ("token #" & i & " = " & output)
     dq.value(i, output)
     print ("value #" & i & " = " & output)
end
 
/* Get a token value by the name. */
dq.tokenvalue("Given Name", output)
print ("Given Name= " & output)