This is a migrated thread and some comments may be shown as answers.

conditional watermark crash during runtime

2 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Wally
Top achievements
Rank 1
Wally asked on 22 Oct 2013, 04:41 PM
The watermark shows fine in the designer using Print Preview.
During runtime there is a crash.

<
Watermarks>
        <TextWatermark Text="= Elixir.App.Reports.DataSources.LoadIsPreliminary(Parameters.site.Value, Parameters.load_key.Value).ToString()" Color="Red" Orientation="Diagonal" Position="Front" Opacity="0.1" PrintOnFirstPage="True" PrintOnLastPage="True">
          <Font Name="helvetica" Size="60pt" />
        </TextWatermark>
      </Watermarks>



using Telerik.Reporting.Expressions;

namespace Elixir.App.Reports.DataSources
{
    class BolFunctions: Telerik.Reporting.Report
    {
        /// <summary>
        /// Is this load preliminary?
        /// 
        /// User function for Telerik reports
        /// </summary>
        /// <param name="site"></param>
        /// <param name="loadKey"></param>
        /// <returns></returns>
        [Function(IsVisible = true, Category = "WatermarkTest", Description = "Testing", Namespace = "Elixir.App.Reports.DataSources", Name="LoadIsPreliminary")]
        public static string LoadIsPreliminary(string site, string loadKey)
        {
            // Would actually prefer that this function  return a bool
            // and let the report output a non-blank watermark if true, otherwise no watermark.

            // Would like to have another boolean function as well, LoadIsSpecialCase2, etc.

            return "This is another test";
           
        }
    }

}
preferred watermark:
<Watermarks>
        <TextWatermark Text="= IIf(Elixir.App.Reports.DataSources.BolReportInfo.LoadIsPreliminary(Parameters.site.Value, Parameters.load_key.Value), &quot;PRELIMINARY&quot;&#xD;&#xA;    IIf(Elixir.App.Reports.DataSources.BolReportInfo.LoadIsCancelled(Parameters.site.Value, Parameters.load_key.Value), &quot;CANCELLED&quot;&quot;&quot;))" Orientation="Diagonal" Position="Front" Opacity="0.1" PrintOnFirstPage="True" PrintOnLastPage="True">
          <Font Name="helvetica" Size="60pt" />
        </TextWatermark>
      </Watermarks>

2 Answers, 1 is accepted

Sort by
0
Wally
Top achievements
Rank 1
answered on 24 Oct 2013, 02:35 PM
This thread may be ignored because a similar issue has been submitted on a support ticket.
0
Stef
Telerik team
answered on 25 Oct 2013, 03:15 PM
Hello,

For anyone concerned, this is a quote from the support ticket:

In your case the type TestWatermarkTrdx.WatermarkUtilities could not be found, because your watermark expression is referring to an assembly which is not resolved. All you have to do is to include this assembly in the Telerik.Reporting AssemblyReferences section in your application's configuration file so it would look like this:
<configuration>
  <configSections>
    <section
      name="Telerik.Reporting"
      type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting"
      allowLocation="true"
      allowDefinition="Everywhere"/>
  </configSections>
  <Telerik.Reporting>
    <AssemblyReferences>
      <add name="TestWatermarkTrdx" version="1.0.0.0" />
    </AssemblyReferences>
  </Telerik.Reporting>
</configuration>
 
The reporting engine will try to resolve all the types from the assemblies mentioned in the AssemblyReferences section so the expressions that are using some user defined functions to work properly."


Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

Tags
General Discussions
Asked by
Wally
Top achievements
Rank 1
Answers by
Wally
Top achievements
Rank 1
Stef
Telerik team
Share this question
or