Note that there are some explanatory texts on larger screens.

plurals
  1. POMultidimensional String Addressed Datastructure in Visual Basic.Net
    text
    copied!<p>I'm looking to create a set of sums that are addressed / used like this in Visual Basic.Net:</p> <pre><code>String ContractTimeFrame, Region, BillingGroup = "IndexHere" Double Value = 42 SumCollectionOrWhatever(ContractTimeFrame)(Region)(BillingGroup)(Customer) += Value </code></pre> <p>Is there a way to do this easily?</p> <p>Note that 'SumCollectionOrWhatever' is a bunch of Doubles that start at zero then increase towards accounting totals. My apologies if the question is poorly stated; I couldn't put the object definition into it because I don't know what it should be.</p> <p>My final datastructure would look something like this:</p> <pre><code>SumCollectionOrWhatever["Annual"]["West"]["Heavy"]["ABC"] == 123 SumCollectionOrWhatever["Annual"]["West"]["Light"]["ABC"] == 456 SumCollectionOrWhatever["Annual"]["East"]["Heavy"]["ABC"] == 123 SumCollectionOrWhatever["Annual"]["East"]["Light"]["ABC"] == 456 SumCollectionOrWhatever["Annual"]["Total"]["All"]["ABC"] == 1158 SumCollectionOrWhatever["Weekly"]["East"]["Heavy"]["ABC"] == 789 SumCollectionOrWhatever["Weekly"]["West"]["Light"]["ABC"] == 12 SumCollectionOrWhatever["Weekly"]["East"]["Heavy"]["ABC"] == 456 SumCollectionOrWhatever["Weekly"]["West"]["Light"]["ABC"] == 12 SumCollectionOrWhatever["Weekly"]["Total"]["All"]["ABC"] == 1269 SumCollectionOrWhatever["Grand"]["Total"]["All"]["ABC"] == 2427 SumCollectionOrWhatever["Annual"]["West"]["Heavy"]["DEF"] == 123 SumCollectionOrWhatever["Annual"]["West"]["Light"]["DEF"] == 456 SumCollectionOrWhatever["Annual"]["East"]["Heavy"]["DEF"] == 123 SumCollectionOrWhatever["Annual"]["East"]["Light"]["DEF"] == 456 SumCollectionOrWhatever["Annual"]["Total"]["All"]["DEF"] == 1158 SumCollectionOrWhatever["Weekly"]["East"]["Heavy"]["DEF"] == 789 SumCollectionOrWhatever["Weekly"]["West"]["Light"]["DEF"] == 12 SumCollectionOrWhatever["Weekly"]["East"]["Heavy"]["DEF"] == 456 SumCollectionOrWhatever["Weekly"]["West"]["Light"]["DEF"] == 12 SumCollectionOrWhatever["Weekly"]["Total"]["All"]["DEF"] == 1269 SumCollectionOrWhatever["Grand"]["Total"]["All"]["DEF"] == 2427 </code></pre> <p>NOTE: Edited to add another level of organization. Yes, there are four layers, and I'm beginning to think a four-dimensional array hidden in an object with intelligent addressing / addition is my best bet. The addressing is generally binary (East and West, Weekly and Annual, Heavy and Light) so the datastructure won't be HUGE, but I don't know if .Net has a built-in b-tree or something that would work properly for this. Generic Collection? Anyone?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload