Trying to sort any field fails

I am trying to sortup on any field, but get an error explanation which doesn’t seem to be correct.

The error at the bottom shows quotation marks rather than «»
Am I misunderstanding how to use «» to indicate the current field?

I think what you actually mean is that you want to sort up on the current field. In that case, the only code you need is this:

sortup

You don’t need the field statement, because that statement is for switching to a different field, which is not what you want. The sort statement already sorts by any field, without any additional code.

The solution is above, the rest of my post is just for educational purposes.

In a formula, you can use «» to get the value of the current field. For example, if the current field is Name, this formula:

upper(«»)

will return the value same as this one:

upper(Name)

For example, it might return John Smith.

The field statement, however, is a bit different. Suppose you said:

field Name

If the formula was handled as it is everywhere else, Panorama might try to jump to a field named John Smith. Of course there probably isn’t such a field.

One solution is to create a formula that actually results in the name of the field, like this:

field "Name"

And this actually works fine.

But for convenience, the field statement has a special trick. If the “formula” is nothing but an individual field name, then it doesn’t calculate the value of the formula - it just uses the name. So this formula actually does jump to the Name field, not to John Smith (or whatever value is contained in the Name field).

field Name

This special trick only works if the formula is just a field name, nothing else. So this formula probably won’t work - it will jump to John Smith etc.

field Name+""

What if the field name contains spaces or other punctuation? You can still use the special trick, but you need to use chevrons, like this:

field «First Name»

This is still just a formula with nothing but a single field, so the special trick works.

Now we’re ready to look at your example.

field «»

Whatever is inside the chevrons is the field name. In this case the field name is blank, i.e. “”. So now, hopefully you understand where your error message came from.

I suppose Panorama’s special trick could be extended so that Panorama interpreted «» as the current field in this situation. But what would be the point? All that would do is move the current field to the current field – in other words, it would do nothing. So the best bet is to simply remove the field statement, as I suggested above. It serves no purpose.

Thanks—as always very clear explanation.

Just call me anal but upper(Name) would return JOHN SMITH.
upperword(Name) would return John Smith.