Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Invalid Subscript Reference Error
Message
 
 
À
25/02/2005 12:46:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP3
Database:
Visual FoxPro
Divers
Thread ID:
00990628
Message ID:
00990684
Vues:
16
Rich,

VFP does extra evaluation run to determine the size of the fields in the result set. It may use either the first physical record in the table or empty one for that. The fix would be to make sure that pol.fr_type value is not 0.
SELECT aFarmType[IIF(pol.fr_type=0,1,pol.fr_type)] AS farm_type, ...
>I've found a workaround, but I'm curious as to what would generate this error.
>
>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 tmp
>
>The code above works just fine. If I
>SELECT DISTINCT farm_type FROM tmp
>I will get values 1,2,3,4,5.
>
SELECT aFarmType[farm_type] FROM tmp
>works 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 tmp
>
>I get an "Invalid Subscript Reference" error.
>
>As I said, I do have workarounds for this, but I'm curious as to what could cause this behavior.
>
>Thanks...........Rich
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform