Dictionaries Pan Classic and Pan X


#1

What should I keep in mind if I want Panorama X to pass a dictionary to Panorama 6?

The Pan X help file says.

“The old format is still supported in “read-only” mode – the data in an old format dictionary can still be accessed, but will automatically be converted to the new format if any changes are made.”

I want to grab a dictionary from Pan 6, use it in Pan X, then pass it back to Pan 6.


#2

I think the answer is “you can’t do that”. You would have to save it in some other format.

I wonder what you even mean by “pass it back”. The only way I can think of to even try that would be to save the variable to a file, then load it with fileload(. Is that what you had in mind? Anyway, that definitely won’t work.

For that matter, how do you plan to “grab a dictionary from Pan 6”? Dictionaries aren’t generally loose items that can be accessed independently. If they are saved at all, it is usually in a permanent variable embedded in a database. You can bring them into Panorama X by importing the database into Panorama X, but that doesn’t sound like what you mean. It is possible to save a dictionary to a file, so perhaps that is what you mean. But if so, you might be the first person I’ve heard of to have done that.

Perhaps if you let us know what your actual application is, someone here might have a suggestion as to how it could be done. But there is not going to be some simple, one line answer. Most likely you will have to convert the data into some sort of text format, and then write code in Panorama 6 that will parse that format.


#3

I save dictionaries in some of my databases, as they are really just specialized arrays. My advanced stock quotation procedure gets lots of information, and I put it in a field so if I decide to access more of it, I can do it without connecting to the Internet. Here is an example:

˛NameˇOracle Corporation Common Stock˛/Nameˇ˛LastSaleˇ38.48˛/LastSaleˇ˛DChangeˇ-0.75˛/DChangeˇ˛Targetˇ45˛/Targetˇ˛DHighˇ38.88˛/DHighˇ˛DLowˇ38.18˛/DLowˇ˛Volumeˇ22,532,550˛/Volumeˇ˛Previousˇ39.23˛/Previousˇ˛Dividendˇ0.60˛/Dividendˇ˛Ex-dividendˇApr. 12, 2016˛/Ex-dividendˇ˛PaymentDateˇApr 28, 2016˛/PaymentDateˇ˛EPSˇ2.07˛/EPSˇ˛P/Eˇ18.59˛/P/Eˇ˛AHighˇ42˛/AHighˇ˛ALowˇ33.13˛/ALowˇ˛DescriptionˇOracle Corporation provides products and services that address all aspects of
corporate information technology (IT) environments–application, platform and
infrastructure–and are available to customers either via cloud computing or
on-premises deployment models. Our products include database and middleware
software, application software, cloud infrastructure software and hardware
systems (Oracle Engineered Systems, servers, storage, networking and industry
specific products), along with support and related services. We offer over
400,000 worldwide customers a choice of deployment models to best suit their
needs including (1) the deployment of our products via our Oracle Cloud
offerings, (2) the acquisition of Oracle products and services for an
on-premises IT environment or (3) a mix of these two models.  … More …  
˛/Descriptionˇ˛MarketCapˇ158,642,650,400˛/MarketCapˇ˛AnnualEPSestˇ$2.43˛/AnnualEPSestˇ˛QuarterEPSestˇ0.54˛/QuarterEPSestˇ˛PEGratioˇ1.64˛/PEGratioˇ˛MeanRecommendationˇ2.17˛/MeanRecommendationˇ

That rather incomprehensible blob is a lot of data on Oracle stock, which is best accessed by using dictionary functions, but it is all there.

So if this is what Steve is doing, and wants to change it in X and send it back to 6, there are a few ways I can see doing this. The best would be to rebuild the 6 dictionary from the data in the X dictionary. Another is to track the changes in X and make those changes in 6. A third might be to parse out the X dictionary and construct it back into a 6 dictionary.


#4

Yes, but there is no mechanism for doing that. Panorama 6 can’t read the Panorama X dictionary format, and Panorama X can’t write the Panorama 6 dictionary format.

Of course, the Panorama 6 dictionary format is very simple, so it wouldn’t be THAT hard to write a procedure that would take a Panorama X dictionary and convert it into a Panorama 6 dictionary, as long as the dictionary didn’t contain any binary values (unlike Panorama 6, in Panorama X a dictionary can contain numbers and binary values.) I don’t think there would be that much use for this so I don’t plan to write this code, but there are several people on here that I’m sure could pull it off.

Dictionaries and arrays are quite a bit more capable in Panorama X than they were in Panorama 6. This topic is covered in great detail (2 hours 18 minutes) in the Data Collections video session.


#5

Well, if dictionaries are compatible at all, one should be able to take a 6 dictionary, convert it to an X dictionary, read the pairs of data on the X side, and write the pairs of data back on the 6 side. I have not had time to go through the videos, but I think that is a reasonable assumption. Of course, if you start with an X dictionary, all bets are off if you try to put the data into a 6 dictionary.


#6

At the data level, they are not compatible at all. In Panorama 6, dictionaries were text with special delimiters. In Panorama X, dictionaries are based on NSDictionary, a data structure defined by and used by Cocoa (the NS stands for NeXT Step, the original system that OS X and iOS were based on). Because of this, you can store arbitrary data in any dictionary element, for example numbers can be stored as numbers instead of text – you can even put dictionaries inside of dictionaries. This is the native dictionary structure used by Objective-C, now accessible to Panorama.

At the programming level, dictionaries in 6/X are compatible. For example functions like getdictionaryvalue( and listdictionarykeys( work exactly the same. But the underlying storage is different. If you pass a Panorama 6 dictionary to Panorama X it will internally convert it to the new format. But there are no functions or statements that convert the new format to the old format (and if there was, you could possibly lose data since the new dictionary format can store things that could not be stored before).

So take your example of a dictionary stored in a disk file. You probably read the dictionary in from the disk like this:

local mydict
mydict = fileload("somefile.data") // using the new one parameter fileload option, but that doesn't matter to this example

At this point, mydict has a Panorama 6 format dictionary in it. But now lets add another value (or change an existing value):

setdictionaryvalue mydict, "Price",2.99

Now mydict is in Panorama X format. Notice also that I have stored a number without converting the number to text. So this works.

message getdictionaryvalue(mydict,"Price")+2

No val( function required for this calculation – getdictionaryvalue( is returning the same exact numeric value that was put into the dictionary. It could also be floating point, or binary (which in Panorama X is not the same thing as text, because text is now unicode).

But back to the original point, even if I had added a text value, mydict would be converted to the new format. Any statement or function that changes, adds or deletes a dictionary value will cause the dictionary to be automatically converted to the new format.

Now suppose I write this dictionary to a file:

filesave "somefile.data",mydict // again, using new simplified syntax for filesave

Now this file contains a Panorama X dictionary, and it can no longer be read by Panorama 6. (For that matter, it won’t be readable by people either – unlike the old format, the new format looks like gibberish, but Objective-C understands it.)


#7

I had to extend my Mail window to almost 450 mm wide to read this post - was that Bruce’s initial format or something in the transmission? All other posts have been fine.

michael


#8

I don’t know – I have no problem with the width of this topic in either the web browser or in my email.


#9

That post ( BruceDeB -June 28 ) also showed up in Mail for me without line breaks as well. So far the only one that has.


#10

It might be the format of the dictionary that I copied to the post. It has not line breaks. I do not get this in Mail, so I cannot say for certain.


#11

FWIW, I too am getting the need for scrolling horizontally in this thread as well.

Robert Ameeti
(949) 422-6866


#12

Okay, back to the subject. In Pan 6, I can store a dictionary in a field and retrieve data from it. Trying to do that in Pan X gives me an error: getdictionaryvalue( dictionary parameter must be a valid dictionary.


#13

Are you using a Binary field to store the dictionary? In Panorama X, binary data can no longer be stored in text fields, you have to explicitly set up a binary field. And dictionaries are no longer text values, they are pure binary values. There is coverage of this topic in the free Panorama X Basics and Converting from Panorama 6 to X videos. The complete details are in the Data Values video. You will also probably want to look at this help page:

Importing Binary Data from Panorama 6

The Converting from Panorama 6 to X videos shows the steps described on this page in action.


#14

Hi Jim, the reason for this question is that I am using Panorama X as a front end to Panorama 6 server utilizing urltask() and url(). It works really well but this is only temporary for me until Panorama X Server is ready. I was wanting to post a Panorama X dictionary to a Panorama 6 hosted database, then when needed, grab it from the hosted database and use it in Panorama X. I don’t think I will need to process the Panorama X dictionary in Panorama 6 other than to store it in a Panorama 6 hosted database.

If this is possible, how can I create an array of dictionaries? I would want the array to end up like this. I am hoping that arraytablefloor( , arraylookup(, array sort, etc will work with this. It will be this array of dictionaries that will be stored in a Panorama 6 hosted database field.

Qty,mydictionary
1000, mydictionary
2000, mydictionary
etc


#15

I think that dictionaries are not what you want to use. You should only use arrays instead. Then there is should be no compatibility problem.


#16

I don’t think I really recommend this, but you could convert the Panorama X dictionary (or any binary value, including a data array of dictionaries – see the Data Collections video) to text with the encodebase64( function and then upload it to Panorama 6. Then you when you get it back from Panorama 6 you can turn it back into a dictionary with the decodebase64( function. You say you don’t need to access the data in Panorama 6, that’s good, because you won’t be able to.