"Query" Parameter


#1

Hello Everybody,

I am running Pan X to start to become familiar with it, and I see it is still a work in progress. I’m running into many of the problems I read about in this forum. I’m sure Jim will get them all sorted out.

But I have here a question - not a complaint.

In Pan X, some functions (like arrayselectedbuild) have a 4th parameter called Query, which allows one to restrict the scope of the function. The Help file gives the example Price > 100.

But couldn’t that restriction be covered in the Formula parameter with a conditional? For example, if the formula was “Field A”, couldn’t one have instead ?(Price > 100, Field A,""). I can’t understand why the new query parameter is needed, and when it should be best used.

By the way, Pan X won’t Quit. Hey Jim, maybe that could be a light-hearted selling point. “The database that will never quit on you!”.

Best regards,
Vic


#2

It potentially makes things more efficient. With a ?( function, both the true and the false parameters need to be evaluated, and if the true parameter is complex, Panorama could be expending a fair amount of effort returning a value that won’t be used.

If the query comes up false, it just moves on to the next record, without evaluating the formula. The query would be most useful if the formula does a lookup(, or a call( function, or something else that isn’t especially fast.

It would also be useful if evaluating the true parameter would cause an error, such as division by zero.


#3

Dave has made the primary points I would have made, especially improved performance.

In addition to the performance issue, certainly using ?( was possible, but I think doing so is less straightforward than using the new query parameter. To me,

arraybuild(", ","Fish Tank",{Fish},{Price>30})

is easier to write and read than this:

arraybuild(", ","Fish Tank",{?(Price>30,Fish,"")})

Also, hopefully it is clear in the documentation that the new query parameter is optional. You are certainly free to continue to use only 3 parameters, and to use ?( in the regular formula for compatibility with existing Panorama 6 databases, or if you simply like it better than using the new query parameter.