Custom Query Sequence Question

I’m building a custom query dialog and wonder why:

QUERY ([LOTS_2]; & ; Field (vTable;vField)->;vOp;$Str;*)
works fine, but…

QUERY ([LOTS_2]; vJoiner{1} ; Field (vTable;vField)->;vOp;$Str;*)
QUERY ([LOTS_2]; vJoin ; Field (vTable;vField)->;vOp;$Str;*)
Will not.

…when vJoiner{1} and vJoin = “&”

I think the starting line of a query sequence is not allowed to have the “join” parameter. Only the lines #2 to #{end-1} can be generic.

The thing you found with literal “&” seems like an exception.

Ahh - sorry - I should have mentioned - that is the second line of a built search.

Can you use a variable for the conjunction? I thought it had to be a literal.

You could use ORDA or SQL if you need to vary the conjunction.

My experience would bear that out - but it seems counter intuitive. The same is true for the asterix as well, but not the operator.

It means there is no other option except :

Case of

: (aConCode{aConjunct2}="&")

QUERY ([LOTS_2]; & ; Field (vTable;vField)->;vOp;$Str;*)

: (aConCode{aConjunct2}="|")

QUERY ([LOTS_2]; | ; Field (vTable;vField)->;vOp;$Str;*)

: (aConCode{aConjunct2}="#")

QUERY ([LOTS_2];#; Field (vTable;vField)->;vOp;$Str;*)

End case

for each subsequent line of the built query.

Possibly there is a technical reason to do with the & being a language expression rather than a value. To be honest I don’t think I’ve ever needed to have a variable conjunction.

Are the inputs for that being entered by the user?

Yes; a custom query dialog enabling a first time user to build his/her own plain english query.

The conjunction is a three line popup; And, Or, Except.

Ok, cool.

If it is the field names that you want to be in plain english then you could use SET FIELD TITLES then QUERY([LOT_2]) to give the user the normal 4D query dialog with your own customised list of fields. Don’t know if that’s useful … but thought I’d better mention it just in case.