Hide duplicate Component (not only textfield)

Stimulsoft Reports.NET discussion
markbosshard
Posts: 16
Joined: Thu Mar 12, 2015 3:28 pm

Hide duplicate Component (not only textfield)

Post by markbosshard »

Hi

I have a component, that is being printed many times with the current data. Now within my Data source "related_requirements_2" I have duplicate item, where all attributes are exactly the same. Nevertheless attributes CAN sometimes be the same (like a true or false flag and obviously we have more than 2 data items). The important criterion is that "related_requirements_2.Code" should never twice be the same.

Compare my .mrt file as well as Image 1 showing the designer and schematically the data
image1.png
image1.png (58.14 KiB) Viewed 5147 times
Be aware also that I have NO property "processDuplicate" on my Richtext-Field. How can I process that one if duplicate?

I tried using the "processing duplicates" setting. I set a Tag value {related_requirements_2.Code} and set my processing duplicates to "Hide based on Tag". this does not hide anything. I set it also to others, e.g. "Hide based on value and tag" is making the text disappear, BUT only the text, and all the rest of the field (frame etc.) stays.

Compare image 2 showing pdf output: As you see I was able to remove the Title fields (PARAM0016 and "Tage vor SSL...") with this property without any problems! even the space is filled up.
image2.png
image2.png (64.47 KiB) Viewed 5147 times
My other approach was to set the following code in the data band property (tried after print, before print, rendering, ...) and setting up a local variable "Already_Printed_Parameters0" as Stringlist:

if(Already_Printed_Parameters0.Contains(Related_Requirements_2.Code)){
((Stimulsoft.Report.Components.StiComponent)(sender)).Enabled = false;
} else {
Already_Printed_Parameters0.Add(Related_Requirements_2.Code);
((Stimulsoft.Report.Components.StiComponent)(sender)).Enabled = true;
}

However it showed that setting .Enabled to true or false always affected ALL items, or in other words the whole sticomponent and NOT it's instances.

Thanks a lot for helping me on how to get rid of these duplicates!

regards,
Mark :)
Attachments
K-KON0020-GR.mrt
(294.25 KiB) Downloaded 412 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Hide duplicate Component (not only textfield)

Post by HighAley »

Hello.

If you need to hide the whole data band then you could use such code in Before Print event of the Data Band.
As we see you set the Number of Pass property of the report to Double Pass, then you should check if the IsSecondPass system variable is true.
Please, look at the attached report template.

Thank you.
Attachments
Report.mrt
(23.06 KiB) Downloaded 624 times
markbosshard
Posts: 16
Joined: Thu Mar 12, 2015 3:28 pm

Re: Hide duplicate Component (not only textfield)

Post by markbosshard »

Hi Aleksey

Thanks a lot for your fast answer! I have modified the code and introduced the IsSecondPass check. However, still all of the elements are hidden with this code and no first one is displayed. Do you have an idea, what I am doing wrong?

if (IsSecondPass){
if(Already_Printed_Parameters0.Contains(Related_Requirements_2.Code)){
((Stimulsoft.Report.Components.StiComponent)(sender)).Enabled = false;
} else {
Already_Printed_Parameters0.Add(Related_Requirements_2.Code);
((Stimulsoft.Report.Components.StiComponent)(sender)).Enabled = true;
}
}

Thanks!

regards
Mark :)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Hide duplicate Component (not only textfield)

Post by HighAley »

Hello, Mark.

Do you use Before Print event of the Band?
If yes, please, send us your report template with sample data.

Thank you.
markbosshard
Posts: 16
Joined: Thu Mar 12, 2015 3:28 pm

Re: Hide duplicate Component (not only textfield)

Post by markbosshard »

Hi Aleksey

Yes, I used the Before Print field (onBeforePrint or so in the code) and put the code in the report I sent you exactly as posted above. I don't know if I have a way to export my data, My program is directly fetching it via ODBC I guess? I'm using Visure Report Manager and it's getting the data from Visure requirements I think.

So you can't figure out where the problem could lie without sample data? do you know about a way to export the data from visure report manager?

thanks a lot and regards to Belarus
Mark
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Hide duplicate Component (not only textfield)

Post by HighAley »

Hello.

As a way, you can use the following code in the BeforePrint event of a page and sent us the files you will get.

Code: Select all

{YourDataTableName}.DataTable.DataSet.WriteXml("e:\\data.xml");
{YourDataTableName}.DataTable.DataSet.WriteXmlSchema("e:\\data.xsd");
Thank you.
markbosshard
Posts: 16
Joined: Thu Mar 12, 2015 3:28 pm

Re: Hide duplicate Component (not only textfield)

Post by markbosshard »

Hi Aleksey

Thanks for your help! If I try to export the XML like this I only get this:

Code: Select all

<?xml version="1.0" standalone="true"?>
-<Visure> -<Projects> <CanModify>0</CanModify> <Date>2012-05-07T14:42:45+02:00</Date> <IdCode>1</IdCode> <IdDomain>0</IdDomain> <Light>0</Light> <Code/> <Description/> <DomainName/> <Name>abx-tax Produkt</Name> <Scope/> <FinishDate>1899-12-30T00:00:00+01:00</FinishDate> </Projects> </Visure>
If I remove the .DataSet ({YourDataTableName}.DataTable.WriteXml("e:\\data.xml");) I get some data; but only one single Item.

I put my code in the onBeforePrint of both a Page or Data Item. Same results. I attached you one xsd and one xml file. Thanks for any hints!
Attachments
data6.xml
(54.33 KiB) Downloaded 453 times
data5.xsd
(8.78 KiB) Downloaded 310 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Hide duplicate Component (not only textfield)

Post by HighAley »

Hello.

Sorry, but we can't use this data in the report template.
Could you specify which version of our product do you use?

Thank you.
markbosshard
Posts: 16
Joined: Thu Mar 12, 2015 3:28 pm

Re: Hide duplicate Component (not only textfield)

Post by markbosshard »

Hi

Yes, It is not exporting properly as stated.
We are using Visure Report Manager with stimulsoft reports.net version 2012.2.1302.

regards
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Hide duplicate Component (not only textfield)

Post by HighAley »

Hello, Mark.

Sorry, the provided solution should work in our product, since you don't use our product directly we can't guarantee that there was not made any changes in it.
Also we could not make any improvement in a third-party product.
Please, contact the support service of Visure Solutions S.L.

Thank you.
Post Reply