Fieldvalue( bug when using variables

In Panorama X, this generates an error that data field “fgField” does not exist:

FileGlobal fgText, fgField
fgField = “Name"
fgText = fieldvalue(”",(fgField))

Using the actual field name does work. Trying it in all of its various allowable formats doesn’t make any difference, nor does resorting to grabdata(.

In Panorama 6 this does work, but in X it gets the same error as above:

FileGlobal fgText, fgField
fgField = “Name"
fgText = grabdata(”",(fgField))

I seem to recall encountering this and needing to do something like fgField+"" to force PanX to see the variable as a formula

grabdata( and fieldvalue( are aliases for the same function, i.e., same thing, different name.

Panorama X will treat the parameter as a formula if it contains one or more operators, otherwise it will treat it as a literal name. So adding ( and ) will not turn it into a formula, but adding +"" will. This is the way it is going to work going forward.

And the documentation for fieldvalue( should be revised to reflect this change.

I was going by both the Pan x and Pan 6 documentation, which works on Pan 6.

Done. Here is the revised paragraph:

If the formula calculating the field name is a single field or variable, you must add at least one operator to the formula. For example, fieldvalue(Primary+"") tells Panorama to grab the contents of the field whose name is in Primary. The formula fieldvalue(Primary), however, tells Panorama to grab the contents of the field Primary itself. (Note: In Panorama 6 you could do this by adding parentheses to the field name, but that does not work in Panorama X, there must be at least one operator for Panorama to treat this parameter as a formula.)

1 Like

It’s like an instant bug fix.