Conditional for default entry

Hi there,

I am still a bit confused about the „formula“ and „code“ section in the properties inspector.

Where can I how can I achieve the following:
Let’s say I have a field with the name „amount“ and I want Pan X to enter the word „yes“ into the field „Test“, when amount is greater than 3000. What would be the code and where do I have to enter it?

Next question: What happens, when the value in „amount“ drops below 3000? Is „Test“ recalculated automatically?

Kind regards, Kay

In the Code for “amount” you would enter something like:
Test = ?(amount > 3000,“yes”,“No”)

“No” could just as easily be “” which would empty Test. The code runs anytime the amount is changed.

Thanks a lot… Works!

I tinkered a bit but always had entered the code in the wrong field.
I fear, Pan X has quite a bit of a learning curve…

:sweat_smile:

In this case another way to do it would be to put this formula into the Formula section of the Test field, just as you would with a spreadsheet.

?(amount < 3000,"yes","no")

In this case it doesn’t really matter much which technique you use. But if the formula references multiple fields, it’s much easier to use the Formula section because if you used the Code section you would have to enter the formula multiple times. If all you have to do is a calculation, the Formula section is preferable. The Code section allows you to do things that can’t be done in a formula, for example display a dialog or alert.

I think you must mean a learning curve vs. Panorama 6. In Panorama 6 there were two separate modes: spreadsheet and procedure mode. You had to pick one or the other for the entire database. Many users found this confusing. Panorama X is simpler since you don’t have to pick a mode that must be used for all fields. For each field you can pick either a formula (spreadsheet mode) or code (procedure mode) or both. Even better, the code section now allows any kind of programming, while in Panorama 6 only assignment statements were allowed. Once you get used to it I think you’ll find that the way Panorama X does it is far superior.

1 Like

Jim, are you suggesting that your formula go into the Formula section for the Test field or the Amount field?

Thanks for catching that. I meant to write that the formula goes into the Test field, since that is where the result of the calculation goes. I simply forgot to write that part of the sentence. In addition to this reply, I have gone back and edited the previous post so it now specifies the field as it should have all along.