Case formula/code recalculation problems

I have a simple set of 4 cases I want to operate as a formula in a field:

case JoinTime > 13.15
PanelJoin = “Humor”
case JoinTime > 12.00
PanelJoin = “Historical”
case JoinTime > 10.45
PanelJoin = “Best”
case JoinTime > 9.15
PanelJoin = “Debut”
endcase

This works fine if I enter the PanelJoin field and execute. But as a recalculate field or morph to fill with formula or anything else I can think of globally, it fails. Errors like this: Expression contains an operand when an operator was expected

But then, I find that what I think of as a “formula” is working as “code” in the field properties. This is a recurring nightmare in my 30 (?) years of Panorama use, and I just can’t seem to get these ducks in a row. I’m pretty sure I solved/understood it about 6 months ago, but today not so. Blame in on Covid, maybe.

The manual bit on “case” calls it a formula; and I can get the same result with a series of if/elseif lines. Works on entering/leaving a cell edit, but no other way I’m trying to do it.

There was also an error message somewhere during the last hour or two telling me my field didn’t exist, but of course, it does.

I hope the answer is insanely simple. I’ve thought of just entering each cell in my result field but there are 856 records. Actually, if I’d done that instead of typing this I’d probably be done. But I wouldn’t know what I’m doing wrong. Plus, I have another field to apply “case” to…

If you want to recalculate all 856 records, you have to make a formula out of your procedure code:

field PanelJoin
formulafill ?(JoinTime > 13.15,"Humor",?(JoinTime > 12.00,"Historical",?(JoinTime > 10.45,"Best",?(JoinTime > 9.15,"Debut ",""))))

What you have is not a formula, it is procedure code. A formula is something that calculates a result. Though your code calculates values as part of the code, it does not calculate a result.

Here is a formula that will caluclate the same results as your code, but can be used as a formula in a formulafill statement or in the morph dialog. You can also put this into the Formula area for the PanelJoin field and it will be calculated automatically, and can be used with the Recalculate Field command.

?(JoinTime>13.15,"Humor",
    JoinTime>12.00,"Historical",
    JoinTime>10.45,"Best",
    JoinTime>9.15,"Debut",
    "Unknown")

Kurt, your formula is unnecessarily complex if Panorama X is being used. The ?( function now allows unlimited parameters, so you can use a single ?( function for all of the cases, as I showed in my formula. That way you don’t have to keep track of all the nested parenthese at the end.

Thanks, Jim — this is my old Excel brain. I did not know that Pan X makes nested conditions so much easier to handle.

The nested ?( functions was required in Panorama 6 and earller. There’s been a lot of changes since Panorama X, it’s hard to keep track of all of them! I think this is one of the nice little touches in Panorama X, it really makes dealing with a chain of conditions so much easier.

Brilliant! Thanks as always, Jim. I will try to learn this, I promise…