Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Functions

Status
Not open for further replies.
May 31, 2007
31
0
0
AE
Hi All

I have a script that opens a text file and does some data extraction. the extracted data is then saved to a delimited txt file. A part of the script picks up the full country name as in "United States". I need to replace the "United States" with "USA". I have about 100 countries.

I have created a function within the same script that looks up, and replaces the Long Name with the Abbrevation. This works as expected. My question is how do call the Countrylook up function from the main script

Main Script
***********

Function Main(afile)
--------> Start Data extraction Code
strCountry = (strCountryName)
strCountry = CountryLookup(strCountry) -----> how do i call the function, and set the strCountry value to the value found in the CountryLookup function?

--------> End Data extraction Code
End Function

Country Lookup Function
***********************

Function CountryLookup(aCountry)
Select Case (aCountry)
CASE "United States" CCODE = ("USA")
"
"
"
CASE "Other Country " CCODE = ("OC")
Case Else CCODE = (strError)
End Select
End Function



The strCountry = CountryLookup(strCountry) does not work.

Many thanks
 
Try
Code:
end select
CountryLookup = CCODE
end function
 
You could also stick them into a dictionary to start with an then look up the dictionary. Check the help on dictionary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top