Using Dynamic Dictionaries

For questions and postings not covered by the other forums
M45HY
Posts: 63
Joined: Wed Jul 11, 2012 7:32 am
Location: Mansfield, Nottinghamshire, UK

Using Dynamic Dictionaries

Postby M45HY » Wed Dec 10, 2014 11:26 pm

Hi guys,

I'm trying to use Dynamic Dictionaries and I have never used them previously so I was doing some research on them including looking at the JADE Manual (https://secure.jadeworld.com/downloads/ ... ng.String)).

According to the JADE Manual, it states that Dynamic Dictionaries do not allow persistence, nor do they offer a facility to sort objects not entirely based on a comparison of embedded attribute values; for example, the ability for you to provide your own sort compare routine is not supported. I was slightly confused here; I noticed that the addMemberKey() function requires a property value and two boolean values for sort descending and case insensitive. If the sort descending is false, does that mean that when records are added to the DynaDictionary, they will go in Ascending order or do I have key in true for descending order and then iterate backwards?

Thanks

Omash
"If you can't explain it simply, you don't understand it well enough." - Albert Einstein

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: Using Dynamic Dictionaries

Postby ghosttie » Thu Dec 11, 2014 2:47 am

If you use addExternalKey you can sort the items by something that isn't an embedded attribute, but you're correct that you can't provide your own sort routine.

Sort descending just sets whether the items are sorted in ascending or descending key order: if you added items with keys 2, 1 and 3 and sort descending was false they'd be sorted as 1, 2, 3 whereas if sort descending was true they'd be 3, 2, 1.
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: Using Dynamic Dictionaries

Postby BeeJay » Thu Dec 11, 2014 7:34 am

Hi guys,

I'm trying to use Dynamic Dictionaries and I have never used them previously so I was doing some research on them including looking at the JADE Manual (https://secure.jadeworld.com/downloads/ ... ng.String)).
Are you actually using another language to access your Jade database? If not, and you're writing Jade method logic, then you may find the standard Jade Help more useful:

https://www.jadeworld.com/docs/jade-701 ... _class.htm
According to the JADE Manual, it states that Dynamic Dictionaries do not allow persistence
In the original implementation of DynaDicts that was the case, but in later Jade releases you can now persist dynamic dictionaries. I'm not sure in exactly which Jade release this changed.
nor do they offer a facility to sort objects not entirely based on a comparison of embedded attribute values; for example, the ability for you to provide your own sort compare routine is not supported. I was slightly confused here;
This simply means you can't write your own 'compare' routine and supply it for the DynaDict to use to decide where in the dictionary that entry should be placed.
I noticed that the addMemberKey() function requires a property value and two boolean values for sort descending and case insensitive. If the sort descending is false, does that mean that when records are added to the DynaDictionary, they will go in Ascending order or do I have key in true for descending order and then iterate backwards?
As ghosttie already said, if you don't set the 'descending' parameter to true then the DynaDict will sort in ascending order.
If you use addExternalKey you can sort the items by something that isn't an embedded attribute, but you're correct that you can't provide your own sort routine.
While not directly a sort routine as such, because you choose the 'key value' when coding the DynaDict::putAtKey logic, for a DynaDict created using DynaDict::addExternalKey, you can simulate your own sort routine within the confines of the standard DynaDict sorting algorithms. :)

Cheers,
BeeJay.

M45HY
Posts: 63
Joined: Wed Jul 11, 2012 7:32 am
Location: Mansfield, Nottinghamshire, UK

Re: Using Dynamic Dictionaries

Postby M45HY » Fri Dec 12, 2014 10:53 pm

Thanks Guys,

This helped a lot; I believe I'm on the verge of cracking it, thanks.

Cheers,
Omash
"If you can't explain it simply, you don't understand it well enough." - Albert Einstein


Return to “General Discussion”

Who is online

Users browsing this forum: Bing [Bot] and 22 guests

cron