.CurrentRecord problems

Trying to debug my main procedure in PanX that I’ve been using in Pan6 for years.

I have a form Film DBX:ENTRY that has many text display objects that need to be recalculated with each new record. Using .currentrecord, I call another procedure .currentMainPage when ENTRY is the top window. .currentMainPage does the calculations and displays the variables. It does not have a rtn command to return to .CurrentRecord, it has a stop at the end of the procedure.

Lately, I’ve been getting caught in infinite loops in which sometimes the calculations are made, sometimes not. (BTW: is cmd-. still supposed to cancel a procedure? It is not for me).

I’ve altered the code to try to see what is happening. Here is the code:

gvThisWin=info(“windowname”)
message “Current” // shows .currentrecord called
noshow

CASE gvThisWin=“FILM DBX” ; stop on data sheet
nop
stop

CASE gvThisWin=“FILM DBX:ENTRY” ; process for main window
CALL ".currentMainPage"
stop

[other cases, not relevant to question]

ENDCASE
showpage
endnoshow
STOP

.currentMainPage code

noshow

[defining lots of variables]

message “MAIN” ; this is a test to show me it is in the right procedure

[lots of calculations involving different files and windows]

statusmessage info(“databasename”)
showpage
message “Done” //shows procedure has run
stop

Right now, .currentrecord is running (I get the “Current” message), .currentMainPage runs (I get the “Main” and “Done” messages, and the calculations are made and displayed) but it goes into an infinite loop, constantly calling the .currentrecord procedure for the same record. The only way to stop is Force Quit or manage to close the ENTRY window while it is calculating.

Did not have this problem in Pan6, though I’ve been making so many changes to the .currentMainPage procedure in PanX that I may have tripped something.

What makes it constantly trigger .currentrecord, and how do I stop it? Is there now a better way to do this?

FWIW: About halfway through the Training Videos.

Thanks
Martin

The .CurrentRecord procedure is intended to allow very minor operations when moving to a different record, maybe set a variable or something like that, 2 or 3 lines of code. You are trying to use it to completely rework the way Panorama works. I’m sorry, but that is not what it is for.

At a minimum, the showpage statement you are using triggers Panorama into thinking that the current record has changed. So this triggers the .CurrentRecord procedure again, causing an infinite loop.

Panorama is very flexible, but it is not infinitely flexible. I’m afraid we are not going to support bending Panorama this far. I really never wanted to add the .CurrentRecord feature because I was afraid it would be abused this way, but it can be useful for very quick, short operations. I see your comment “lots of calculations involving different files and windows” and I say no way, that is not supported, and has never been supported even if it happened to work in a particular version of Panorama. Sorry about that.

Jim:
In this case the .CurrentRecord is just calling another procedure [.currentMainPage] that does all of the heavy lifting. [in real life it is part of a CASE statement that calls a different procedure depending on the window]. Nothing terribly complicated in the actual .CurrentRecord. Does the called procedure operate as part of .CurrentRecord? Or is the whole concept of doing all of this calcs with each record abuse? (I feel sad that I am a Panorama Abuser);>

Is the showpage behavior different in PanX than Pan6? I just checked again in Pan6 and the procedure has the showpage and does not trigger a loop.

And is there a different way to get out of a loop in PanX, as cmd-. is not working for me?

Thanks
Martin

Martin McCaffery
martinmc@knology.net

Well, perhaps a nicer way to put it is that this really pushed the edges of envelope. I can’t blame you for doing that, but I will ask you to understand that the edge of the envelope can change from time to time, especially with a major release like this.

When you call a subroutine, it’s as if the code of the subroutine was included in the calling procedure. Using subroutines is a convenience because it allows code to be re-used in multiple places without having to retype it, but from the point of view of running the code, it makes no difference.

Or is the whole concept of doing all of this calcs with each record abuse?

Yes, that’s it.

Is the showpage behavior different in PanX than Pan6?

I didn’t test it, but based on your report I’m guessing that it is different. There’s simply no way that a complete rewrite like this can operate 100% identically in every detail. I was shooting for 90-95%. In any case, I never anticipated that showpage would be used in this routine.

is there a different way to get out of a loop in PanX

No, there is no way to get out of a loop.

Well, as they say, you can’t make things idiot proof because idiots are so ingenious.
Thanks
Martin