Extracts attributes from a string.
Category: | Data Quality |
Returned data type: | Character |
Note: | The returned value is a value, token, or token value from the extract function. |
DQ.EXTRACTdefinition, string
definition
a string representing the name of the extraction definition in the QKB
string
a string that represents the attribute that needs to be extracted
The DQ.EXTRACT function extracts attributes from a string into tokens. The first parameter is the name of the QKB extraction definition. The second is the string where the attributes are extracted. This function returns a number of tokens that were created. It returns 0 if it fails.
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)