![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Total counts w/ Comb of 3 attributes Topic Summary: Need to get total counts for a combination of 3 attributes. What is the best method? Created On: 25-Apr-2008 20:26 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I have 3 attributes to run metrics for.
For each CSC there will be a CDR and for each CDR there will be a SW status. I need to get the total counts of the matches. Problem is that the total number of matches could be huge. CSC = 11 values CDR = 8 values SW = 6 values. What is the count per SW value, per CDR value, per CSC value, is what I need to get. // Step 3 Collect data for each attribute for (a=0; a <= attrSize; a++) { // Step 4 if (attrCSC == at.strings[a]) { // match top attribute // count up total for CSC // Step 5 for (b=0; b <= attrSizeCDR; b++) { // Step 6 if (attrCDR == atCDR.strings) { // match 2nd attribute // count up total for CDR per CSC // Step 7 for (c=0; c <= attrSizeSW; c++) { // Step 8 if (attrSW == atSW.strings[c]) { // match 3rd attribute // count up total for SW per CSC. } // Step 8 } // Step 7 } // Step 6 } // Step 5 } //step 4 if } // step 3 |
|
![]() |
|
![]() |
|
Hi,
With the numbers you gave, it sounds like you could have anywhere from 1 to 528 different numbers you'd report. Will you want this info to be easily placed in a spreadsheet to be tracked over time? If so, you'll likely want to report all 528 values (btw, 11*8*6=528). Otherwise, if you want to generated the shortest possible report for each time you run this script, I recommend using a Skiplist to track which combinations you find as you run through your 3 different attributes. The nifty thing with a skiplist is you can't put items into it with a given key if there's already an item in the skiplist with the key. check out the attached code with an example similar to your scenario. Since I dont know what the different possible values are for the 3 attributes you mentioned (CSC, CDR, and SW), let's consider an example with these following 3 attributes and values: Animals can be Mouse, Cat, or Dog Vegitables can be Carrots, Broccoli or Zucchini Minerals can be Iron, Calcium or NaCl Thus, in this example, we might have up to 3*3*3=27 numbers to report. Note: on line 27 where you set "b = ..." you can add in other text to format the key. As is, it will print out something like: There were 4 Objects with the combination CatZucchiniNaCl But with some fiddling on line 27, it could read: There were 4 Objects with the combination Cat - Zucchini - NaCl Hope it helps! Jason |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Total counts w/ Comb of 3 attributes
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.