Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Table range grouping not displaying correctly
Katieee
<p>I have a table and it has customers and various details in. Each customer has a certain number assigned to them:</p>
<ol><li>0</li>
<li>50</li>
<li>90</li>
<li>91</li>
<li>99</li>
</ol><p>I'm trying to group them together by number but it isn't working so well. It groups them but isn't always accurate. The formula I've got working best is below:</p>
<p> </p>
<div>
<div style="color:rgb(0,0,0);font-family:Tahoma;font-size:medium;">
<div>
<div><span style="font-size:10pt;"><b>for</b></span> <span style="font-size:10pt;">(i=11; i<500; i+=11){</span></div>
<div><span style="font-size:10pt;"><b>if</b></span> <span style="font-size:10pt;">( row[</span><span style="font-size:10pt;">"CTST"</span> <span style="font-size:10pt;">] < i ){</span></div>
<div><span style="font-size:10pt;">rangeStart = i-11;</span></div>
<div><span style="font-size:10pt;">rangeEnd = i-9;</span></div>
<div><span style="font-size:10pt;"><b>break</b></span> <span style="font-size:10pt;">;</span></div>
<div><span style="font-size:10pt;">}</span></div>
<div><span style="font-size:10pt;">}</span></div>
<div><span style="font-size:10pt;">displayString = rangeStart + </span><span style="font-size:10pt;">" - "</span><span style="font-size:10pt;"> + rangeEnd;</span></div>
</div>
</div>
</div>
<p> </p>
<p>the ranges it comes up with are as follows:</p>
<ol><li>0-6 (hits 0 range)</li>
<li>44-50 (hits 50 range)</li>
<li>88-94 (hits 90 range)</li>
<li>91 range value is not created for some reason</li>
<li>99-105 (hits 99 range)</li>
</ol><p> </p>
<p>It hits every value the customers have other than 91 - BIRT acknowledges it and breaks it off into a new group like it does with the rest of them but does not display any kind of range like it does with the others - I've tried changing the range multiple times but it never gives me a range value for those with a value of 91. Does anyone know why?<br><br>
*Edit* If I un suppress the column it sits in it displays it as 88-90 when it should be a new range as 91 doesn't come into 88-90.</p>
Find more posts tagged with
Comments
Hawaiian Geff
<p>Based on the logic, it is doing what it should by putting 91 in with 88-99.</p>
<p>i=99</p>
<p>91 < 99</p>
<p>rangeStart: 99-11 = 88</p>
<p>rangeEnd: 99-9 = 90</p>
<p> </p>
<p>Why is 50 in 44-46 ok?</p>
Katieee
<p>Oh yeah true - changed it that many times I didn't even pick up on that! thankyou! I've edited my question to correctly reflect my report now
<br><br>
It just creates it's own grouping for 91 like it does with the rest but misses the range number off :S I can upload an image if that would help?</p>
Hawaiian Geff
<p>The groups don't appear to follow a sequence that fit a for loop. You may need to use a different technique to assign the customers into the appropriate group.</p>
Katieee
<p>Any ideas on how I could do that Geff?</p>
Hawaiian Geff
<p>2 easy ones would be a series of if statements or use an array.</p>
<p> </p>
<p>It isn't clear what the groups are, you are expecting a different result than what your code and example show.</p>
<p>How does 91 not go into the group 88-94? </p>
<p>How do you get from 0-6 to 44-50 when the sequence should be:</p>
<p>0-6</p>
<p>7-13</p>
<p>14-20</p>
<p>21-27</p>
<p>28-34</p>
<p>35-41</p>
<p>42-48</p>
<p>49-55</p>
<p> </p>
<p>To do a sequence by 7, something like the following could be used:</p>
<p> </p>
<div>var j=7; //increment by this number</div>
<div>var x=0;</div>
<div>var y=0;</div>
<div>for (i=-1; i<500; i+=j) {</div>
<div> x = i + 1; //lower end</div>
<div> y = i + j; //upper end</div>
<div> if (<span style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;">row[</span><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;">"CTST"</span><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:medium;"> </span><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;">]</span> <= y) //is customer in range?</div>
<div> break;</div>
<div>}</div>
<div><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;">displayString = x + </span><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;">" - "</span><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;"> + y;</span></div>