Pano6 - Learning to avoid the clipboard


#1

Good Morning,
Over the years, I have learned that we should avoid the clipboard in repetitive Pano6 operations. Would you please help me understand how to generally construct simple formulas that avoid the clipboard when the goal is to do things similar to the following. Thank You.

Window "Membership File:Youth/Children Choir"
Field "ID Number"
Copy
Window "TEST:TRIP"
Field "BID01"
Paste

Window "Membership File:Youth/Children Choir"
Field "FName"
Copy
Window "TEST:TRIP"
Field "FName01"
Paste

Window "Membership File:Youth/Children Choir"
Field "LName"
Copy
Window "TEST:TRIP"
Field "LName01"
Paste


#2

It seems you have an ID number in both databases. So all you need is to enter the ID in your TEST database.

Then you can use formula fills with lookup( functions in your fields FName and LName.


#3

As long as both files are set to the proper record, in Panorama 6 you could simply use:

Window "TEST:TRIP"
ID01=grabdata("Membership File",«ID Number»)

while in Panorama X the grabdata( function has been changed to fieldvalue(:

Window "TEST:TRIP"
ID01=fieldvalue("Membership File",«ID Number»)

or alternately:

setactivedatabase "TEST"
ID01=fieldvalue("Membership File",«ID Number»)
setactivedatabase ""

#4

Thank you so much for helping.

Do I have to go back and forth between databases for each field that I want to do this copy/paste for? Is there a formula batch method for grabbing a group of fields in one database and assigning those values to another database where the field names are not identical? Typically, it is a single student record with multiple fields that needs to go to the other database and have the data go to various fields for manipulation. You are correct, I do have a consistent and unique Student ID for every kid.

(I am building bus lists, rooming lists, class project lists and similar from a multiple thousand record home database. Once transferred, I use the data to build static web pages that contain pictures and biographical links for classroom operation. I make a page for each kid. This is partially why I asked an earlier question about the “web publishing” feature in Pano. I am searching for a faster Pano solution. I have used the Copy/Paste clipboard method for many years and it does work but really pounds the application. With your help, I would like to learn more and progress beyond the basics. I just do not have the computer background knowledge to get past the brute force method of accomplishing the task.) Thanks for listening and helping.


#5

While Gary’s approach works on a 1-record basis (and you have to take care that the appropriate record is active in both databases, my approach can be used to enter a lot of ID numbers into records in the TEST database and then let a procedure lookup the data from the other database and fill the data columns. No manual switching between the databases.

It might be a little bit more complicated because you seem to be using line items (I notice the numbers after the field names).


#6

Here is what you could use for multiple transfers:

Window "TEST:TRIP"
ID01=grabdata("Membership File",«ID Number»)
FName01 =grabdata("Membership File", FName)
LName01 =grabdata("Membership File", LName)
Window "Membership File:Youth/Children Choir"

This goes to the second database and assigns the various fields and then returns to the original file. You might also want to check out the post statement which is designed for posting multiple values to multiple fields from one database to another.


#7

In Panorama X grabdata( and fieldvalue( are synonyms – you can use either and they work identically. But if you look in the documentation, it is listed under fieldvalue(. This change is strictly because I think fieldvalue( is a name that makes it much clearer than grabdata( that what this function does is get the value from a field.

The suggestions by Gary and Kurt are excellent, and more in line with how I would program things. But to directly answer your question, the clipboard is essentially an un-named variable, so you can one-for-one replace it with an explicitly declared variable. Here is a code that is just like yours but using a variable (which I called temp) instead of the clipboard.

local temp
Window "Membership File:Youth/Children Choir"
temp = «ID Number»
Window "TEST:TRIP"
BID01 = temp
Window "Membership File:Youth/Children Choir"
temp = FName
Window "TEST:TRIP"
FName01 = temp
Window "Membership File:Youth/Children Choir"
temp = LName
Window "TEST:TRIP"
LName01 = temp

Since you can set up as many variables as you want, you can reduce the back and forth between windows, in fact, by using 3 variables you can just flip over to the other window once and back.

local tempID,tempFName,tempLName
Window "Membership File:Youth/Children Choir"
tempID = «ID Number»
tempFName = FName
tempLName = LName
Window "TEST:TRIP"
BID01 = tempID
FName01 = tempFName
LName01 = tempLName

Usually to avoid using the clipboard you need to use a variable instead. However, in this case, you can make the whole thing a lot simpler because all the data is readily available in the current record in each database and can be directly accessed with the grabdata( function (or fieldvalue( in Panorama X). I’m going to assume that the “TEST:TRIP” window is already active, then the entire task can be done in three lines of code, with no back and forth of windows!

BID01 = grabdata("Membership File","ID Number")
FName01 =  grabdata("Membership File","FName")
LName01 =  grabdata("Membership File","LName")

I’ve put the field names in the grabdata( function in quotes, but you can also do it as Gary did above (my last example is pretty much identical to Gary’s), without the quotes (but then chevrons are required for ID Number).


#8

Thank You all so very much!

I will practice these skills and see if I can learn the concept. This is so very helpful and appreciated.

I really live by the Pano application in my daily teaching. I read everything you post and try my best to learn. I knew there had to be a faster and better way to do things.

As a novice in programming, it is sometimes like being in a foreign country. I see your complex formulas and sometimes I can understand the individual “words” but I lack the knowledge to make formula “sentences”. Thank you for taking your valuable time to help.


#9

Actually, I like “grabdata” better as you are grabbing the data from another field. Maybe “grabfieldvalue”?

Not that you should spend a second on it just now.


#10

Well that was obviously the original idea. However, there is data in places besides fields – variables, for example. With a generic name like grabdata( a user might think it could access variables, files, or any kind of data, but grabdata( doesn’t access data in variables, files or any place except fields. Also, if you are a new Panorama user are you likely to search for “grab” or “data” to find this function? I don’t think so, but you are much more likely to search for “field”, and then you’ll find it. Really, the top reason I made this change was to make this function more “google-able” in the Help wizard (and in Google itself, for that matter – you know the Panorama X Help can be searched by Google, right?)

Anyway, you can continue to use grabdata( if you like. I’m not planning on ever removing it. It’s literally just one line of code!