Associative Arrays

Started by Jeffrey Ferreira, October 17, 2022, 11:06:23 AM

Previous topic - Next topic

Jeffrey Ferreira

Hello All,

If I have a small associative array of items like this
INSTALL_ITEM_ARRAY["INS1"]=1
INSTALL_ITEM_ARRAY["INS2"]=1
INSTALL_ITEM_ARRAY["INS3"]=1

If I check to see if item is in the array it adds that item to array with a value of 0.
Question -> Is there a way i can check the array without it adding it to array. Is this taking up room in memory ...
if i'm checking a few million invoices lines - i dont want to run into an error 31

I know i can use a memory file but the associative array is quite convenient.

thanks

jeff

Mike King

Have you tried

X = DIM(INDEX INSTALL_ITEM_ARRAY["INSx"])

The DIM(INDEX) will return you the index for the selected item or zero if not in the array.  It will not add the elelment.

Mike King
President - BBSysco Consulting - http://www.bbsysco.com
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

Thanks Mike
that is exactly what i am looking for.

jeff