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)
Suppressing in BIRT.
alecsia
<p>Hello!</p>
<p>I am new to BIRTH, and I guess my question can be very easy, but I need to build a report where cells will be merged dependent on Personal_ID (or Name) of a person, but I don’t need to use a grouping. Manual suppressing of duplicates doesn’t work correctly for me: there can be several, for example, Positions of different people, and it suppresses them all, but I need to suppress only those rows which are connected with one person only. Suppressing works only until it hits the different value in a cell, but I need to limit the merging somehow manually to have something like this (“d†different, “s†same):</p>
<div>
<pre class="_prettyXprint">
AGG NAME POSITION HOLIDAY_TYPE HOLIDAY_DAYS DAYS
1. Name(d) Position(d) Holiday_type(s) Holiday_dates(d) Days(d)
Holiday_dates(d) Days(d)
Holiday_dates(d) Days(d)
2. Name(d) Position(s) Holiday_type(s) Holiday_dates(d) Days(s)
Holiday_dates(d) Days(s)
3. Name(d) Position(s) Holiday_type(s) Holiday_dates(d) Days(d)
Holiday_dates(d) Days(d)</pre>
</div>
<p>But with incorrect suppressing it looks like this:</p>
<pre class="_prettyXprint">
AGG NAME POSITION HOLIDAY_TYPE HOLIDAY_DAYS DAYS
1. Name(d) Position(d) Holiday_type (s) Holiday_dates(d) Days(d)
Holiday_dates(d) Days(d)
Holiday_dates(d) Days(d)
2. Name(d) Position(s) Holiday_dates(d) Days(s)
Holiday_dates(d)
3. Name(d) Holiday_dates(d) Days(d)
Holiday_dates(d) Days(d)</pre>
<p>I tried to use scripting and play with visibility, probably I do something wrong, but it doesn’t work…</p>
<p>Thank you in advance!</p>
Find more posts tagged with
Comments
micajblock
<p>Can you provide sample data? Easier to build an example.</p>
PaulCooper
<p>What method are you using to suppressing the fields in the first place? Setting the visibility based of the previous record values which are stored in Javascript or Global variables?</p>
<p> </p>
<p>If so then use the value and variable for the Name field only to set the visibility for all these columns (Name, Poisition and Holiday Type). That should if I have understood you correctly solve the issue.</p>
<p> </p>
<p>Providing a rptdesign file using say the Classic Models sample data showing the issue would make it easier for us to help.</p>
alecsia
<p>I have stopped at using Drop property, but I kept getting half-blank rows instead of merged ones. Then I tried to use a method of manual suppressing provided by BIRT Guru in his report examples in one old thread. I was initializing variables, adjusting visibility and scripting borders at onCreate. I managed to do this partially, but I have issues with borders, my Top border is absent. Plus, Aggregation doesn’t work the way I want it: I am using Runningcount, and it counts every row, while I need it to count those merged rows as one row. For example, rows 3-4 and 5-6 are those suppressed and should be considered as just one row 3 and 4 respectively. The column Holiday_type is suppressed completely having the same data, but I need to have this data (“Ocновной отпуÑкâ€) on every row (two if suppressed) dependent on person’s name, but just one time… Columns Period and Days look the way they should, they are not supposed to be suppressed.</p>
<p> </p>
<p>The example with Classic Models is not very accurate, since it doesn’t have exactly the same data which reflect the issue better. I have made screenshots to illustrate the problem.</p>
<p> </p>
<p>Scripting I use:</p>
<p> </p>
<p>Header row, onCreate:</p>
<pre class="_prettyXprint">
name="";
position="";
holiday_type="";</pre>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">Detail row NAME, onCreate:</span></span></span></p>
<pre class="_prettyXprint">
if(name === row["NAME"]){
this.getStyle().borderBottomStyle = "none";
}</pre>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">Visibility property for Name:</span></span></span></p>
<pre class="_prettyXprint">
if(name === row["NAME"]){
true;
}
else{
name = row["NAME"];
false;
}</pre>
<p><span style="color:#000000;"><span style="font-family:'segoe ui', sans-serif;"><span style="font-size:10pt;">Detail row POSITION, onCreate:</span></span></span></p>
<pre class="_prettyXprint">
if(name === row["NAME"] && position === row["POSITION"]){
this.getStyle().borderBottomStyle = "none";
}</pre>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">Visibility property for Position:</span></span></span></p>
<pre class="_prettyXprint">
if(name === row["NAME"] && position === row["POSITION"]){
true;
}
else{
position = row["POSITION"];
false;
}</pre>
<p><span style="color:#000000;"><span style="font-family:'segoe ui', sans-serif;"><span style="font-size:10pt;">Detail row HOLIDAY_TYPE, onCreate:</span></span></span></p>
<pre class="_prettyXprint">
if(name === row["NAME"] && position === row["POSITION"] && holiday_type === row["HOLIDAY_TYPE"]){
this.getStyle().borderBottomStyle = "none";
}</pre>
<p>Visibility property for Holiday_type:</p>
<pre class="_prettyXprint">
if(name === row["NAME"] && position === row["POSITION"] && holiday_type === row["HOLIDAY_TYPE"]){
true;
}
else{
holiday_type = row["HOLIDAY_TYPE"];
false;
}</pre>
micajblock
<p>Back to the original question. can you do a CSV extract of your data or other sample data so we can build an example. </p>
alecsia
<p>I don’t have installed CSV emitter, I hope it will be ok if I download data in .xls and then save it in .csv. Since the data is are Russian, I translated main columns I need. </p>
micajblock
<p>Please save the file as UTF8. The Russian characters do not come out right. An Excel file is also OK. Also if you can provide sample output what you want it to look like (Excel is OK for this. </p>
alecsia
<p>I hope it will work now! I deleted excessive information, now it looks cleaner; and I am attaching .txt file in UTF-8 too in case .csv won’t work. Also I have created a sample in Excel of what I have now plus what I want instead. And I have made a screenshot just in case.</p>
micajblock
<p>OK, I think I got it the way you want. What I did:</p>
<ol><li>Create a computed field on the data set that is a unique key with the concatenation of the 3 fields name, position, holiday type.</li>
<li>Grouped by the key.</li>
<li>Put the fields in the group header and set the the Drop property to detail.</li>
<li>Added a group counter for the Number (look at the scripts).</li>
<li>Set all the padding to 0 and placed borders only where I wanted to make sure everything aligns up.</li>
</ol><p> </p>
<p>Look at the attached design.</p>
alecsia
<p>Thank you a lot!!! I appreciate your help and patience, it works perfectly!!! </p>
micajblock
<p>You're welcome.</p>
alecsia
<p>mblock, good morning, I hope you can help me again since you are familiar with my report design!</p>
<p>I need to alter my report a bit by adding a group Department. It works perfectly, the only problem is numbers… I need counting to start over in every new group, while right now I have this:</p>
<pre class="_prettyXprint">
DEPARTMENT1
1
2
3
DEPARTMENT2
4
5
6</pre>
<p>But what I need is:</p>
<pre class="_prettyXprint">
DEPARTMENT1
1
2
3
DEPARTMENT2
1
2
3</pre>
<p>Probably I need to use some script, but I am not sure where to begin, and it will be great if I can learn how to do this!</p>
micajblock
<p>see attached example</p>
alecsia
<p>It doesn’t work entirely correctly, it behaves like aggregation, it counts every row in my second group UniqueKey which you created before, that which with merged cells… Although, every department starts with 1 now… It seems it somehow needs to be grouped by UniqueKey Group as it is now, but with some kind of dependency on Department Group… </p>
micajblock
<p>I do not understand. In any case the key is when to restart the numbering. That can be done with or without grouping. You can store the 'key' of when you want to restart in a variable same as the counter. If the key changes restart the numbering. </p>
alecsia
<p>I even studied your XML, I don’t see big differences, it seems I do everything you did, but it counts my every row anyway…</p>
<p>Is there a separate script for defining that “key� Or you meant scripting with “grpCounter�</p>
micajblock
<p>I am still not sure what is not working attached is a design that renumbers without a grouping in the reports. </p>
alecsia
<p>Good morning!</p>
<p>Thank you a lot for you help again, I used your script, I modified it a bit and made it work, now everything is perfect! </p>