get data, do some processes on them, retrive and display them on report??

Stimulsoft Reports.WEB discussion
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

get data, do some processes on them, retrive and display them on report??

Post by Jan »

Hello,

Please show me how you call this function in report? I mean text expression which use this function.

Thank you.
M.I.A
Posts: 22
Joined: Thu Mar 11, 2010 1:50 am

get data, do some processes on them, retrive and display them on report??

Post by M.I.A »

hello Andrew, Jan, Vladimir and all of the rest in this forum, i would like to tell you that my report and my function are working now exactly as i want.

I really appreciate your help and your great support.

About my last problem it is just small wrong from me, because in the datasourse in stimulsoft report environment under the Date column i put the datatype String, and after i changed it to DateTime my report working properly now.

This is the last code which is working now, and after i did few changes in that application you sent to me.

Code: Select all


namespace MyClassNamespace
{
    public class MyClass
    {
        public static string GetUserText(DateTime greg)
        {
            GregorianCalendar Grn = new GregorianCalendar();
            UmAlQuraCalendar Umq = new UmAlQuraCalendar();

            int year = Umq.GetYear(greg);
            int month = Umq.GetMonth(greg);
            int day = Umq.GetDayOfMonth(greg);

            string hijri = year.ToString() + "/" + month.ToString() + "/" + day.ToString();
            return hijri;
        }
    }
}

namespace WebViewer_UserFunction
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(General.ConnString);

            string sql= "SELECT EnrDate, EnrStudentName FROM nEnrollment";

            SqlDataAdapter da = new SqlDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            da.Fill(ds);

            string appDirectory = HttpContext.Current.Server.MapPath(string.Empty);
            string reportPart = appDirectory + "\\SampleReport.mrt";
            
            
            StiReport report = new StiReport();
            report.Load(reportPart);

            report.RegData(ds);
            report.Script = string.Format("using MyClassNamespace;\n{0}", report.Script);

            string[] referencedAssemblies = new string[report.ReferencedAssemblies.Length + 1];
            report.ReferencedAssemblies.CopyTo(referencedAssemblies, 0);
            referencedAssemblies[referencedAssemblies.Length - 1] = "WebViewer_UserFunction.dll";
            report.ReferencedAssemblies = referencedAssemblies;

            StiWebViewer1.Report = report;
        }
    }
}
And in the text editor of the Text Component i wrote this:

{MyClass.GetUserText(DataSource1.EnrDate)}


So my report is working properly now :).

Thank you again.
Attachments
380.SampleReport.mrt
(6.65 KiB) Downloaded 219 times
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

get data, do some processes on them, retrive and display them on report??

Post by Andrew »

Thank you for your post! That will be very helpful for all forum community.

Post Reply