AnsweredAssumed Answered

Search with a Wildcard and a Dictionary?

Question asked by ionarawilson on Jan 9, 2014
Latest reply on Jan 16, 2014 by ionarawilson
I am using a dictionary for domains in the database. So if the user searches for the "Referral Vendor", the query will search for the code "RV". However Some domain names are really complex for the user to type and I want to add a wildcard. Is it possible to use wildcard with a a dictionary?. Because if I use the % wildcard, and the user types for example "Ref", there is not a key on the dictionary with "Ref", so it will not able to find the value in the database. Thank you for any help!

private function doSearch():void    {     var dict:Dictionary = new Dictionary();     dict["Alpine"] = "AL";     dict["Austin"] = "AU";               dict["Referral - Consulting Forester"] = "RC";     dict["Referral Vendor"] = "RV";          dict["Incidental Rural Forestry"] = "AIR";     dict["Prevention and Reduction of Pest Losses"] = "AP";     dict["Forest Health Monitoring - Survey"] = "FHS";     dict["Forest Inventory & Analysis (FIA) Assist"] = "FSU";     dict["AO - Assist - Oak Wilt Not On-Sites"] = "AO";     dict["AIO - Assist - Incidental Oak Wilt"] = "AIO";     dict["PO - Presentation - Oak Wilt"] = "PO";     dict["TGO - Training Given - Oak Wilt"] = "TGO";     dict["TRO - Training Received - Oak Wilt"] = "TRO";     dict["TGU - Training Given - Urban Forestry"] = "TGU";     dict["TRU - Training Received - Urban Forestry"] = "TRU";     dict["Incidental Urban Forestry"] = "AIU";     dict["Referral - Arborist"] = "RA";     dict["FEPP Support and Assistance"] = "FIN";     dict["Training given - Coordination/Assistance fire and/or emergency non fire"] = "TFC";               myAttributeTable.featureLayer = myFeatureLayer     var qText2:String                 qText2  =  "%" + dict[qText.text] + "%"     var defexpr:String =  searchattribute +  eqsymbol +  "'"  +  qText2  + "'";

Outcomes