Speeding Up a Procedure in Panorama 6 -WarpFactor 7 vs. Snail


#1

Speedier Procedure

I have a procedure that will take the active field and then searches the entire database and finds all records that have the identical data.

I am running Mac OS Sierra, and Panorama 6 (transitioning to Pan X but the patch on my arm saying Panorama 6 is not always working). Mac Pro late 2013.

The database has a little over 14,130 records.

If I simply go to a field and do a simple menu Search Find/Search command it is basically instantaneous for the results.

However, if I run my Macro or Procedure it takes about 5 seconds.

I have not tried it yet in Pan X. Still adjusting.

Here is the Procedure:

;Named “FindSameContent” Will find all same fields as active one that are exactly the same
Local LContent
Copy
LContent=clipboard()
execute “Select «”+info(“fieldname”)+"»=clipboard()"

I had a similar issue for a Procedure called “ThisRecordOnly” which simply selects only the active record.

Original Procedure takes about 5 seconds.

noshow
Field “ID”
Copy
Select ID = Clipboard()
Endnoshow

Whereas this procedure is below basically instantaneous with over 14,000 records.

;This is called “This Record Only Speed”

noshow
Local LRecordID
LRecordID=ID
Select ID=LRecordID
endnoshow

What is the issue for the incredible differences in speed?

Is there lurking somewhere a “Select Active Record Only” function or command, just out of curiosity?

Regards,

George Beauchemin


Finding same content in an active field with a procedure-Issues with Field Names with a space in them
#2

It’s because of the clipboard. Accessing the clipboard is MUCH slower than accessing a Panorama variable. To find out the clipboard value, Panorama has to make a special request to macOS. This is fairly time consuming. When you perform a select, Panorama calculates the formula you provide over and over again, once for each record. So in this case, it is going to request the clipboard value over 14,000 times. Of course the value will be the same every time, but it doesn’t know that, so it has to make the request over and over again. Moral of the story – don’t use the clipboard in calculations!

This issue will be exactly the same in Panorama X. The problem is the delay that macOS imposes in accessing the clipboard value.


#3

Re: [Panorama Discussion Forum] [Panorama “Classic”] Speeding Up a Procedure in Panorama 6 -WarpFactor 7 vs. Snail
Got it Jim.
Thanks.
Out with the Clipboard, in with the Variable.
Quite informative.
Moral of the story is now burned into my brain.
Best Regards,
George


#4

Finding same content in an active field with a procedure on Panorama 6. MacOS Sierra.

I wrote about this recently and Jim cleared up the initial issue eloquently. The other two member also helped out but I cannot now see their responses so thank you also, missing names.

Here:

I have battled error issues with the procedure below, which seems quite simple.

But when I execute it it works with a field name without a space within it’s Field Name but I get error messages when the Field Name has a space, Like “Area Code” or “Address 1”.

It took me hours to run this correlation down.

Is it a “bug”, or is my syntax somehow not quite correct?

Hours of frustration. What am I doing wrong on such a simple procedure?

PROCEDURE

;

;---------------------------Called “.FindSameContent-Faster”

;Find same content in field- this is the new version. Faster
;
Local LFieldName,LFieldContent
LFieldName=info(“fieldname”)
LFieldContent=GRABDATA("",info(“fieldname”))
;
execute {Select }+LFieldName+{="}+LFieldContent+{"}
show
endnoshow

END OF PROEDURE

Many thanks.

George


#5

Here is a corrected version of your code that will work even if the field name has a space in it. I also made a change so that it will work if the field happens to change a quote in it. Also, the show and endnoshow statements were unnecessary so I removed them (unless there was something in the earlier code that required them, in that case, then show should have been showpage).

Local LFieldName,LFieldContent
LFieldName=info(“fieldname”)
LFieldContent=GRABDATA("",info(“fieldname”))
;
execute {Select «}+LFieldName+{»=}+quoted(LFieldContent)

FYI, your procedure could be quite a bit simpler! Here is a minimal version that should work just the same.

local LFieldContent
LFieldContent = «»
select «»=LFieldContent

This takes advantage of the fact that Panorama accepts «» as shorthand for “the current field”. This will work in both Panorama 6 and Panorama X. In fact, this is basically the same code Panorama uses if you right click on a cell and choose Select Same from the pop-up menu.


#6

Merci beaucoup Jim.

The true work of an artist!

Lean and mean.

I always think “If I can conceive it, Panorama can do it.”

Still transitioning to Pan X, but I see the brilliance and improvements as I progress.

Three lines of code. Lean!

Regards,

George Beauchemin


#7

In Panorama X only two lines of code are needed!

let LFieldContent = «»
select «»=LFieldContent

I didn’t post that because you were asking about Panorama 6.