How do I refer to a Text box in an Event?

Stimulsoft Reports.NET discussion
MerChen
Posts: 15
Joined: Mon Jun 28, 2010 12:23 pm

How do I refer to a Text box in an Event?

Post by MerChen »

I have a text box which has the expression:

{((Div(SumIf(DataBand1,ReportData.NUM_EES_PARENT_CHILD*ReportData.AVG_BASE_PARENT_CHILD_VALUE,ReportData.TARGET_RATE1>0),SumIf(DataBand1,ReportData.NUM_EES_PARENT_CHILD*ReportData.TARGET_RATE1,ReportData.AVG_BASE_PARENT_CHILD_VALUE>0)))*100) - 100}

The text box is named Text13. If the value is -100, I want it to display a null. I thought of doing this using the Before Print Event but I don't know how to refer to Text13 in the code. Can anybody help please?
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

How do I refer to a Text box in an Event?

Post by Ivan »

Hello,

Please try to use following code in the GetValue event of Text13:

Code: Select all

if (((Div(SumIf(DataBand1, ReportData.NUM_EES_PARENT_CHILD * ReportData.AVG_BASE_PARENT_CHILD_VALUE, ReportData.TARGET_RATE1 > 0), SumIf(DataBand1, ReportData.NUM_EES_PARENT_CHILD * ReportData.TARGET_RATE1, ReportData.AVG_BASE_PARENT_CHILD_VALUE > 0))) * 100) - 100 == -100)
{
	e.Value = "";
}
Thank you.
MerChen
Posts: 15
Joined: Mon Jun 28, 2010 12:23 pm

How do I refer to a Text box in an Event?

Post by MerChen »

Thanks for your reply Ivan. I tried that and it errored with the following message

"No overload for method 'Sum' takes 4 arguments "

If it's of any use, I clicked into the code, and it shows this:

Code: Select all

        public void Text13_GetValue(object sender, Stimulsoft.Report.Events.StiGetValueEventArgs e)
        {
            if (((Stimulsoft.Report.Dictionary.StiFunctionsMath.Div(Totals.Sum(DataBand1, this, "GetTotal1", ReportData.TARGET_RATE1 > 0), Totals.Sum(DataBand1, this, "GetTotal2", ReportData.AVG_BASE_PARENT_CHILD_VALUE > 0))) * 100) - 100 == -100)

{

    e.Value = "";

};
        }
Thanks,
Chen.
MerChen
Posts: 15
Joined: Mon Jun 28, 2010 12:23 pm

How do I refer to a Text box in an Event?

Post by MerChen »

Sorry, I forgot to mention that I have this Text13 in a Group Footer Band.

Thanks,
Chen.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How do I refer to a Text box in an Event?

Post by Jan »

Hello,

Can you say which version of Stimulsoft Reports you are use?

Thank you.
MerChen
Posts: 15
Joined: Mon Jun 28, 2010 12:23 pm

How do I refer to a Text box in an Event?

Post by MerChen »

Hi, yes it's version 2009.3.600.0.

Thanks,
Chen.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

How do I refer to a Text box in an Event?

Post by Ivan »

Hello,

We made some improvements in that direction about a few week ago.
Please check the last prerelease build and let us know about the result.

Thank you.
MerChen
Posts: 15
Joined: Mon Jun 28, 2010 12:23 pm

How do I refer to a Text box in an Event?

Post by MerChen »

Is that to be able to refer to a text box from code? Or something to do with the GetValue event? Or both? For now, I'm stuck with this version - is there any workaround?

Thanks,
Chen.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

How do I refer to a Text box in an Event?

Post by Ivan »

Hello,

Can you please send us a sample report with data, which reproduce the issue, for analysis?

Thank you.
MerChen
Posts: 15
Joined: Mon Jun 28, 2010 12:23 pm

How do I refer to a Text box in an Event?

Post by MerChen »

After speaking with a colleague, we came up with a workaround in the end which was to set up 2 variables and have these roll up in the Rendering Event of the DataBand. Then the expression for Text13 became:

Code: Select all

{IIF(SumBaseWTgtRate == SumTgtRateWBase, null,  Div(SumBaseWTgtRate, SumTgtRateWBase)*100 - 100)}
Ivan, I'm interested in your previous post regarding the improvements. How would these improvements have helped for this issue? Is there a list of improvements of what the latest version includes compared to my current version? I have seen the topic "Stimulsoft Reports.Net version 2010.2 list of changes" but wondered if there was any more detail on that.

Also, rounding back to my original question, I take it there's no way to reference the value from a text box from code? Is that because of the version I'm on?

Thanks,
Chen.
Post Reply