Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you test to see if an array exist
Message
From
03/06/1999 11:43:59
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00225707
Message ID:
00226010
Views:
29
Nick,

When evaluating the type, enclose the array name in quotes:

? Type('A__ARRAY1')

When you test the return value from the statement, use upper case:

If Type('A__ARRAY1')='U' && not 'u'
*Array doesn't exist
EndIf

>Thanks for the tip (especially on command 'release'), however, now I a get an error that says:
>
>Variable 'A__ARRAY1' is not found
>
>here is the code I am trying to run.
>
>* for fms view on core table
>dimension a__array(1,8)
>
>select O_ord_pay.op_main_key, O_ord_pay.op_fmspaidmo, ;
> O_ord_pay.op_po_no, O_ord_pay.op_amt, O_ord_pay.op_vendor,;
> O_ord_pay.op_flag_7, O_ord_pay.op_uniqueid, O_ord_pay.op_date_paid;
> from dbbudget!o_ord_pay;
> where O_ord_pay.op_flag_1 = 3;
> AND O_ord_pay.op_flag_7 <= 98;
> AND O_ord_pay.op_main_key = int(val(.cbomk.value));
> OR (O_ord_pay.op_flag_1 BETWEEN 6 AND 10;
> AND O_ord_pay.op_flag_7 <= 98;
> AND O_ord_pay.op_main_key = int(val(.cbomk.value)));
> order by O_ord_pay.op_date_paid ;
> into array a__array1
>
>if type(a__array1) <> 'u'
> append from array a__array1
> release a__array1
>else
> release a__array1
>endif
>
>I have dimensioned my array before retrieving values into the array. This error occurs when I don't have anything going into an array. I basically just want to continue on if my array has no values.
>
>
>thanks
>nick patel
Previous
Reply
Map
View

Click here to load this message in the networking platform