Focal Point
[SOLVED] Using IsInFile

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/3577086986

March 19, 2018, 02:07 PM
KurtR
[SOLVED] Using IsInFile
I want to be able to use the 'IsInFile()' function in DQS to determine if a string is found within a file.

Specifically, I have a set of database columns any of which may contain a country name anywhere in the data (for example, it may have a postal code or not in the column. I want to compare that against a list of known country names.

When I attempt to use:
isInFile([Address1], ISO_country_list.txt)
in an AlterFormat, an error appears:
Undefined data source for 'ISO_country_list.txt' at 32-56 in 'isInFile([OriginatorAddress1], ISO_country_list_plus.txt)'.

Function 'isInFile' is not applicable for arguments {STRING, } at 1-8 in 'isInFile([OriginatorAddress1], ISO_country_list.txt)'.

Please advise. I would prefer to not have to parse the string into words, then compare against the country code list (which I can put in a table).

Thank you-
-Kurt

This message has been edited. Last edited by: FP Mod Chuck,
March 23, 2018, 01:03 PM
FP Mod Chuck
Hi Kurt

Since no one has responded I suggest you open a case with techsupport..


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
March 23, 2018, 01:36 PM
Jikku.Jacob
Hi Kurt,
you have to create a lookup file in DQS in order to use the IsInFile function. Following is what the help docs says.

boolean isInFile(string srcStr, string fileName)

Searches for the string srcStr in a file defined by the parameter fileName. The parameter fileName must be a constant expression and must point to a dictionary with simple values. The function returns TRUE if srcStr is found in the dictionary, and FALSE otherwise. Before the search starts, the value of srcStr is trimmed (all whitespaces from the beginning and end of the string are removed) which may possibly lead to NULL value of the search value.

See DQS Tutorial Project Section 04 (Using Lookup) -> 04.05 Lookup functions.plan to see an example

Hope this helps.

Jikku


WebFOCUS 8
Windows, All Outputs
March 29, 2018, 01:19 PM
KurtR
Thanks Chuck and Jikku, I have a workaround for the moment, if I encounter challenges, this will help.

Best-
-Kurt


WebFOCUS 8
Windows, All Outputs