DQ.TOKENVALUE Function

Obtains an attribute from the last parse or extract function.

Category: Data Quality
Returned data type: Character
Note: The returned value is a token value from the parse or extract function. Returns true if the token value is found or false if not.

Syntax

DQ.TOKENVALUE(<token string, output string>)

Arguments

token string

returns true if the token is found and false if the token is not found

output string

a string that represents the value for that token

Details

The DQ.TOKENVALUE function is used to retrieve an extraction or parse result value. The first parameter is the token name. It returns the attribute stored in that token in the second parameter. It returns true on success and false on failure (for example, if the token was not found). This function will follow a parse or extract function.

Examples

Example 1

dq dataq

string output

integer o

integer i

 

/* Initialize DQ */

dataq = dq_initialize()

dataq.loadqkb("EN")

 

/* Extract using the "Product Attributes" extraction definition (using QKB PD 2012A) */

o = dataq.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

     dataq.token(i, output)

     print ("token #" & i & " = " & output)

     dataq.value(i, output)

     print ("value #" & i & " = " & output)

end

/* to get a token's value by its name... */

dataq.tokenvalue("Colors", output)

print ("Colors = " & output)

Example 2

/* Parse (using QKB CI 2013A) */

o = dataq.parse("Name", "Mr. John Q Public Sr")

 

/* print all of the tokens available */

print (o & " tokens filled")

for i = 1 to o

begin

     dataq.token(i, output)

     print ("token #" & i & " = " & output)

     dataq.value(i, output)

     print ("value #" & i & " = " & output)

end

 

/* Get a token value by the name. */

dataq.tokenvalue("Given Name", output)

print ("Given Name= " & output)