OT4XB - HASHTABLE

This forum is for eXpress++ general support.
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: OT4XB - HASHTABLE

#11 Post by Eugene Lutsenko »

patito wrote:Hi Eugene


Attached example using dbf and hash
You can make many combinations, even using xsd file, XML, etc etc etc etc.

Best regard
Héctor
Thank you very much! I'll figure it out. Using CSV has no limits on file sizes and the number of fields specific to dbf. These CSV are attractive. However, the disadvantage of CSV is the lack of usability, which is based on the use of indexes when using dbf. If this lack of CSV is overcome, it will be very valuable.

patito
Posts: 121
Joined: Tue Aug 31, 2010 9:01 pm

Re: OT4XB - HASHTABLE

#12 Post by patito »

Hi Jimmy

The expanding class and the htdic class, (dictionary), are
c++-based
And it is similar to the following

aDetalle := {}
oPartida := _ot4xb_expando_():new()
oPartida:cantidad := 1
AAdd(aDetalle, oPartida)
for n := 1 to Len(aDetalle)
nImporte := aDetalle[n]:cantidad * aDetalle[n]:precio

Shortly, ExpandoObject can help you create complex hierarchical objects. For example, imagine that you have a dictionary within a dictionary:
Dictionary<String, object> dict = new Dictionary<string, object>();
Dictionary<String, object> address = new Dictionary<string,object>();
dict["Address"] = address;
address["State"] = "WA";
Console.WriteLine(((Dictionary<string,object>)dict["Address"])["State"]);

The deeper is the hierarchy, the uglier is the code. With ExpandoObject it stays elegant and readable.
dynamic expando = new ExpandoObject();
expando.Address = new ExpandoObject();
expando.Address.State = "WA";
Console.WriteLine(expando.Address.State);

Second, as it was already pointed out, ExpandoObject interface which gives you more control over properties than a dictionary.

Best Regard
Héctor

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: OT4XB - HASHTABLE

#13 Post by unixkd »

Code: Select all

What is the General purpose of OT4XB-HASHTABLE? What are the benefits?
If you write data-driven applications, then one of the things you do frequently is table referrence or Lookup. Ir you want your application to gain speed, it is advisable that you load the entire lookup tables into hashtables and then perform in-memory lookup or search thereby reducing io bootlenecks especially in LAN/WAN enviroments.

Try to convince yourself.

Joe.

Post Reply