Using import() does not appear to work with ArrayFilter


#1

The following:

ArrayFilter Code,Newarray,¶,lookup(“Products”,“ProductCode”,import(),“Item”,"",0)

does not work in Panorama X, although this scenario works fine in Panorama 6. Code is a field in the current database which contains entries separated by a return (essentially a return delimited array). Newarray is the array I’m trying to build and the rest should be obvious. The field Code is text and the field Product Code is numeric. It seems that import() is not working it’s way through the first array. All I get is a blank NewArray. If I replace import() with val(Code), and use only one entry in the Code field, the “item” will be looked up.

Is this a bug?


#2

Import() is always text, so try using val(import()) instead.


#3

Import() is always text, so try using val(import()) instead.

Thanks, but I already tried that. It still returns nothing.


#4

If I understand it, the entire Code array is in a single cell and not a set of records. In that case, it’s most likely that the issue is in the ¶. PanoramaX uses lf() in TextEditors so odds are it’s the same in Data Cells.


#5

Thanks, Jim. I thought of that too. I changed lf() to ¶ within the field, verified that it was changed, ran the procedure and I still get a blank return. I’m still thinking import() may be behaving differently in X than 6. Panorama 6 seems to be ignoring the numeric vs text fields whereas Panorama X is hiccuping.


#6

Too much experimenting!

This works: ArrayFilter Code,Newarray,lf(),lookup(“Products”,“ProductCode”,val(import()),“Item”,"",0)

I had tried val(import()) but not before changing the lf() to ¶. I changed lf() to ¶, but I didn’t add val(import()). I finally started over, changed all the records for Codes back to lf(), added the val(import) and it worked.

import() still works differently in Pan X than it did in Pan 6. Pan 6 didn’t need the val( function to compare the data.

Thanks Dave and Jim for making me realize I didn’t do both at the same time.


#7

Glad you got it to work. If in the future you have text that appears to be separated by something like ¶, but you aren’t sure by which possible return, you could check which by running these:
arraysize(text, cr()) ; for carriage return
arraysize(text, lf()) ; for line feed
arraysize(text, chr(11)) ; for vertical tab
If the result is the correct number of entries, there is your separator (crlf() separator would do that on both of the first two.) Depending on your data source, vertical tab is a possible, easily overlooked, separator that looks like ¶. If the separator isn’t there, or for that matter if the text is empty, arraysize( will return 1.