Altering information in Text Display Object

I have a form that contains a Text List which I use to navigate between records in the database. On the same form is information related to the selected record. Most of the information is relevant to all records, but some of the information is only relevant to certain records, depending on the contents of a single field. Rather than having bizarre non populated information, I would like to format text display objects to vary according to the information in that sentinel field. I have managed to do this by setting a variable, with the contents determined by the sentinel field - however I am having to trigger that by pressing a button. I would like it to be triggered by selecting a new record on the list. My reading suggested one option, but the warning not to use it was so strong, that I didn’t dare!
"Triggering code when moving to a different record

If it exists, the .CurrentRecord procedure will be triggered when the user shifts to a different record. For example, this procedure is triggered when you move up or down in the database with the vertical scroll bar, or with the Find or Find Next commands. It could be used to initialize a variable or graphics object to display the newly current record. However, we recommend that you keep this procedure as short as possible, and actually strongly recommend avoiding use of the .CurrentRecord procedure altogether if at all possible, since it can cause performance problems.

I’m guessing you move from record to record by clicking entries in your text list.
It seems a click on the list could be configured to bring that record into focus, assess the sentinel field to fill the other fields appropriately, and finally issue one of the “Show” commands (showvariables, etc.) to update the form.

If, however, the navigation is via the arrow keys it seems only using the .CurrentRecord procedure will allow for the variable to be update as you go. The procedure code in the Procedure panel for the Text List does not seem to execute when using the arrow keys.

1 Like

I’m guessing that can be fixed - either in the next release of PanX (?) or there is a way to remap the keyboard keys so the arrows report as something else.

The arrow keys do move the selection up and down but they do not trigger the associated procedure. I don’t think remapping them on the keyboard would make any difference.

I think you are overthinking this. It sounds like you shouldn’t need any code at all, just a formula. Are you familiar with the ?( function?

For example, suppose you want a Text Display object to display the Garbanzo field, but only if the Color field is blue (in this example Color is what you are calling the “sentinel” field). This formula will do the trick.

?(Color match "blue",Garbanzo,"")

The Text Display will update automatically when the record changes, you won’t need to trigger any codel

Using a variable is where you are getting mixed up. By involving a variable, you now have to run code. You want to do everything in the Text Display formula, even if that formula is complicated. As long as the sentinel field is included in the formula, the Text Display will update whenever you change to a different record.

I was overthinking because I was underknowing!! Thankyou. That will help me in lots of places, to tidy up my presentation. Panorama X is fantastic - I really can’t believe the professional looking database I have managed to create…

I wonder if you might reference that at the bottom of the if/else help pages?

When I saw this I thought, “You are doing two things.” You are not just changing the content when the color match is blue; you may also be changing the content when the color match is not blue.

If you use ?(Color match “blue”,Garbanzo, yourvariable) I’d think it would change the content or leave it like it was.

He’s not trying to change the content of a variable. The point is that the variable isn’t necessary. If you want a text display to display something when the “sentinel field” has a certain value, and not display anything when the field doesn’t have that value, you can simply use a ?( function as the formula.

If the formula mentions a field in the database, it will automatically be updated when the record changes. There is no need for any procedure statements to make that happen.

Well yes - if, “not display anything” is the desired result. You might have gleaned that from, “…bizarre non populated information, …” I did not.

It wasn’t clear to me if the request was “If X, fill with Garbanzo, else clear” or “If X, fill with Garbonzo, else leave alone”

My point was, the ?( function doesn’t do one thing, it does one of two things. And the though it was clear that Mdunlop wanted to display something when the sentinel appears, it wasn’t clear (to me) that he wanted the display empty when Sentinel was not there.

“I would like information to vary …”, does not equal, “not display anything.”, though “not display anything” is a member of “vary” possibilities.

I see that Mdunlop was pleased with the result. So in this case, “” as the false of the true/false condition, was correct.

PS: For purist … at one time I believe ?(condition, true action, false action) actually did both actions, then evaluated the condition and handed off either the True or the False action depending on the result of the condition.

PPS: An English teacher once instructed a class, “Though we can have a situation where a double negative means a positive, there is no situation where a double positive means a negative.” From the back of the class, a student mumbled, “Yeah, right.”

The main point of Jim’s post was

Jim’s example wasn’t the formula in an assignment statement. It was a formula in a text display. It wasn’t changing the content of anything.

Thankyou all.

That was very perceptive of you. I am indeed displaying something where there are 4 possible pieces of information. So rather than use ?( as an either this information or that information, I set up a series of 4 ?( where the information was either displayed or blank. The end result is the one piece of information I wish to display.

The ?( function, like all functions, wasn’t called until all of it’s parameters had been evaluated. The function never saw the formulas used to determine those values, only the values themselves. Depending on the value of the first parameter (true or false), it would return the value of the second or third parameter.

This is still true in Panorama X. What has changed is the way that errors are handled. Before Panorama X, if an error occurred during the evaluation of a formula, that would stop the evaluation immediately.

Panorama X however, has an error data type. If there is an error in the execution of an operator or function, the error is returned as a value with an error data type, and if there is more to the formula, that value may become an operand or parameter in a subsequent operation or function.

In the case of the ?( function, if one of the last two parameters happens to be an error, but it’s the other one that is returned, there is no problem.

I don’t blame you. I had to read her original post several times before I realized the key request was:

Once I realized that, everything fell into place.

Since Michelle is happy with this solution, I suggest we close this topic.