Page 1 of 2

Hide duplicate Component (not only textfield)

Posted: Thu Mar 12, 2015 4:04 pm
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 5138 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 5138 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 :)

Re: Hide duplicate Component (not only textfield)

Posted: Fri Mar 13, 2015 7:14 am
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.

Re: Hide duplicate Component (not only textfield)

Posted: Fri Mar 13, 2015 8:54 am
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 :)

Re: Hide duplicate Component (not only textfield)

Posted: Fri Mar 13, 2015 10:35 am
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.

Re: Hide duplicate Component (not only textfield)

Posted: Fri Mar 13, 2015 11:21 am
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

Re: Hide duplicate Component (not only textfield)

Posted: Fri Mar 13, 2015 12:38 pm
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.

Re: Hide duplicate Component (not only textfield)

Posted: Mon Mar 16, 2015 7:26 am
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!

Re: Hide duplicate Component (not only textfield)

Posted: Mon Mar 16, 2015 3:26 pm
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.

Re: Hide duplicate Component (not only textfield)

Posted: Mon Mar 16, 2015 4:02 pm
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

Re: Hide duplicate Component (not only textfield)

Posted: Tue Mar 17, 2015 5:19 am
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.