DIME aFarmType[5] && policy.fr_type aFarmType[1] = 'Field Crop Farms ' aFarmType[2] = 'Truck Farms ' aFarmType[3] = 'Poultry Farms ' aFarmType[4] = 'Livestock Farms ' aFarmType[5] = 'Field Crop and Livestock' SELECT pol.fr_type AS farm_type, loc.state,pol.pol_num; FROM policy pol,location loc; WHERE loc.agentcode=pol.agentcode and loc.ctrl_num=pol.ctrl_num; AND loc.locat_num = 1; ORDER BY farm_type,state; INTO CURSOR tmpThe code above works just fine. If I
SELECT DISTINCT farm_type FROM tmpI will get values 1,2,3,4,5.
SELECT aFarmType[farm_type] FROM tmpworks just fine. However, when I try to combine all this into one SELECT statement
SELECT aFarmType[pol.fr_type] AS farm_type, loc.state,pol.pol_num; FROM policy pol,location loc; WHERE loc.agentcode=pol.agentcode and loc.ctrl_num=pol.ctrl_num; AND loc.locat_num = 1; INTO CURSOR tmpI get an "Invalid Subscript Reference" error.