PreCompiled Report

Stimulsoft Reports.NET discussion
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: PreCompiled Report

Post by Alex K. »

Hello,

Let us know if you need any additional help.

Thank you.
simgschw
Posts: 73
Joined: Mon Jan 07, 2013 1:34 pm

Re: PreCompiled Report

Post by simgschw »

Hi,

I still have some difficulties to set variables in the precompiled report.

I load the report as you suggested. Then the variables are set like this:

Code: Select all

report[varname] = value;
This works for my sample project. But in my "real" project I does nothing. The report ist a blank page.

What I've done wrong?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: PreCompiled Report

Post by Alex K. »

Hello,

Can you please send us a sample project which reproduce the issue with variables for analysis.

Thank you.
simgschw
Posts: 73
Joined: Mon Jan 07, 2013 1:34 pm

Re: PreCompiled Report

Post by simgschw »

So, now I can tell you what's the problem.

after replacing the base type in the script of the report(as you told me) i compile the report to an assembly. after loading the report from the assembly I had a quick look at the script. Unfortunately the script does not contain any component of the original report and this is why viewing the precompiled report results in a blank page.

The script after replacing the base type with code line

Code: Select all

Script = Script.Replace(" : Stimulsoft.Report.StiReport", " : reportingInXanthos.XanthosReport");

Code: Select all

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;
using Grz.Xanthos.Services.Report;

namespace Reports
{
    
	public class Befund : reportingInXanthos.XanthosReport
	{
        
		public Befund()
		{
			this.InitializeComponent();
		}
		#region StiReport Designer generated code - do not modify
		#endregion StiReport Designer generated code - do not modify
		
		public string SetKopfDaten(){
			try{
				return StimulsoftReportHelper.FormatInstitutsDaten(Zuweisung.MandantKopf,Zuweisung.BereichKopf);
			}catch{
				return Zuweisung.MandantKopf.Replace("[{Bereich.BereichKopf}]", Zuweisung.BereichKopf);
			}
		}
		
	
		private void AnforderungenSichtbar(){	
			if(string.IsNullOrEmpty(Zuweisung.Anforderungsnummer)){
				PanelAnforderung.SelectAll();
				PanelAnforderung.RemoveAllSelected();
			}
		}
		
		public string SetENummer(){
			try{
				string enummer =  StimulsoftReportHelper.FormatENummer(Zuweisung.BereichKuerzel,MaterialEingang.ENummer,MaterialEingang.ENummerBis,MaterialEingang.SubNummer, Zuweisung.MandantId);
			
				if(Zuweisung.laufendeNr > 0){
					enummer += "-" + Zuweisung.laufendeNr;
				}
				return enummer;
			}catch{
				return MaterialEingang.ENummer.ToString();
			}
			
		}
		
		
		
		private FontStyle DiagnoseStyle {get{return FontStyle.Bold | FontStyle.Underline;}}
		public void FormatDiagnoseText(){
			if(ZuweisungTexteFooter.Kategorie == 2)
				this.txtZuweisungFooterText.Font = new Font(this.txtZuweisungFooterText.Font, DiagnoseStyle);
			else
				this.txtZuweisungFooterText.Font = new Font(this.txtZuweisungFooterText.Font, FontStyle.Regular);
		}
		public string AusgangsDatumUndOrt(){			
			string datum = Zuweisung["Ausgangsdatum"] == DBNull.Value ? string.Empty : ((DateTime)(StiReport.ChangeType(Zuweisung["Ausgangsdatum"], typeof(DateTime), true))).ToShortDateString();
			return "Wien, am " + datum;
		}
		
		public string MatZusatzKuerzel(){
			return "MZ";
		}
		public string FormatText(string text){
			try{
				return StimulsoftReportHelper.FormatHTMLText(text);
			}catch{
				return text;
			}
		}
		public string GetBefundStatus(){
			try{
				string befundStatus = string.Empty;
				befundStatus = StimulsoftReportHelper.GetBefundStatus(Zuweisung.ZuweisungStatus);
				if (Zuweisung.Ausgangsdatum.HasValue){
					befundStatus += " (" + Format("{0:dd.MM.yyyy}", Zuweisung.Ausgangsdatum.Value) + ")";
				}
				return befundStatus;
			}catch{
				return Zuweisung.ZuweisungStatus.ToString();
			}
		}
		
		public string FormatPatientName(){
			string s = Zuweisung.PatientName;
			bool beistrich = false;
			if(!string.IsNullOrEmpty(Zuweisung.PatientAkademischVor)){
				s = string.Format("{0}, {1}",s, Zuweisung.PatientAkademischVor);
				beistrich = true;
			}
			
			if(!string.IsNullOrEmpty(Zuweisung.PatientTitel)){
				s = string.Format("{0}{1} {2}",s,beistrich ? string.Empty : ",",Zuweisung.PatientTitel);
			}
			
			s = string.Format ("{0} {1}",s,Zuweisung.PatientVorname);
			
			if(!string.IsNullOrEmpty(Zuweisung.PatientAkademischNach)){
				s = string.Format("{0} {1}",s,Zuweisung.PatientAkademischNach);
			}
			
			return s;
		}
			
		public string FormatZuweiserAdresse(){
			string s = string.Empty;
			
			if(!string.IsNullOrEmpty(Zuweiser.Land)){
				s = Zuweiser.Land + "-";
			}
			s = string.Format("{0}{1} {2} {3}",s,Zuweiser.PLZ,Zuweiser.Ort,Zuweiser.Ortsteil);
			return s;
		}
	}
}

and after loading the report from the assembly the script looks like this:

Code: Select all

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;

namespace Reports
{
    public class Report : reportingInXanthos.XanthosReport
    {
        public Report()        {
            this.InitializeComponent();
        }

        #region StiReport Designer generated code - do not modify
        #endregion StiReport Designer generated code - do not modify
    }
}

So why is this happening?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: PreCompiled Report

Post by HighAley »

Hello.

Could you send us a working project which reproduces the issue?

Thank you.
Post Reply