I can't get the chevronquoted( function to work


#1

The variable * SearchFieldName* contains the name of a field, for example “Transaction number”, but this statement:

field chevronquoted(SearchFieldName)

gives the error, field “«Transaction number»” does not exist in database ….

This works:

execute {field } + chevronquoted(SearchFieldName)

Why?


#2

OK, if I want to use a variable for a field name with the field statement, I should use:

field (variablename)

but

field (chevronquoted(SearchFieldName))

doesn’t work either.


#3

Because the field command allows you to write a command like

Field MyField

when the normal rules for quoting would require

Field "MyField"

Panorama requires you to do a little more to indicate that you really are referring to the content of the field and not just its name. Both of these should work.

Field (SearchFieldName)

and

Field («SearchFieldName»)

you could also use a function to return the field name, but if you do, it will consider every character in the result to be part of that name. In your case it thinks the chevrons in «Transaction number» are part of the name, and it can’t find a field whose name begins with «.

Characters that might normally cause confusion, when they are part of a field name, such as spaces, or an operator like + or - or / will not be a problem when they are in the result of a formula, and chevrons are not needed.

You need to use chevrons in

Field «Transaction number»

because, without them, Panorama would have thought the field name was Transaction, and number was the beginning of the next statement, but

SearchFieldName = "Transaction number"
Field (SearchFieldName)

causes no such confusion. It’s clear where the statement begins and ends.


#4

Thank you Dave - an excellent little tutorial. I was confusing myself by over-thinking the issue.