Superlookup - no value for import( function

I have not been able to use superlookup( nested inside an arrayfilter( function or statement. I get the error “no value for import( function”. The same error if I use related( instead of superlookup(.

This is the basic code for what I’m trying to do:

arrayfilter(localArray,¶,|||import() + " -- " + superlookup("OtherFile",{FieldA=import()},{FieldB+FieldC})|||)

Is this a bug, a limitation?

I have never been successful using import() in more than one nested function. You might be able to work around this by using the cache( function.

arrayfilter(localArray,¶,|||cache(import(),tempVar)+ " -- " + superlookup("OtherFile",{FieldA=tempVar},{FieldB+FieldC})|||)

Bingo. Yes, this is a limitation.

Even if it did work, it would be pretty small if localArray is any significant size. If the array is small enough, you could code this with a loop. Something like this (note that I have not run this code, it may have mistakes):

let result = ""
looparray localarray,cr(),anitem
    let temp = anitem + " -- "+ superlookup("OtherFile",{FieldA=anitem},{FieldB+FieldC})|||)
    result = sandwich("",result,cr())+temp

Actually, since superlookup( is probably the big time consumer here, this is probably not that much slower than it would be if arrayfilter could be used.

Gary, I also thought cache( was the answer here, but it gives the same error.

Thank you Jim, I ideally wanted all of this compressed in a single formula for a text display object, but a looparray would do.

You could use the execute( function to put it in a text array. I’m not sure if you really want to do all that in a display formula, you may find it too slow. Though as I said, it’s probably going to be similar speed to what arrayfilter would be. It all depends on how big the array is and how big the second database is.

BTW, if you used the execute( function you could also display the result in a Text List object. That might be nicer formatting.

Thank you Jim, I think I will end up using looparray( in a procedure and then update the Text Display with a variable, as I need to do some additional operations anyway.

You probably saw a few crash reports from my system yesterday. In my efforts to combine arrayfilter( and superlookup( I also tried using seq() in a Text Display Object like this:

arrayfilter(localArray,¶,|||import() + " -- " + superlookup("OtherFile",{FieldA=array(localArray,seq(),¶)},{FieldB+FieldC})|||)

This also didn’t work, however, any further modifications to the form graphics crashed Panorama. Then opening that same file crashed panorama on start up. I had to recover the file from a previous backup to fix this.

I don’t get to look at every crash report in detail every day! However, after your message I went and looked, and this was one of the fun cases where the crash report pointed directly to the culprit. :slight_smile:

It’s now fixed so it doesn’t crash. It still doesn’t work the way you want, but it doesn’t crash.

Also I mispoke in another thread where I showed a crash report. I said the Source column would contain Panorama, but that was wrong. For Panorama code, it will show the class name of the code within Panorama. So FormLayer, FormView, GenericTextObject etc. are all classes within Panorama – in other words, components within Panorama.