Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Wednesday, February 3, 2021 5:05:14 AM(UTC)

Rank: Newbie

Groups: Registered
Joined: 1/13/2021(UTC)
Posts: 0
Location: Chennai

Thanks: 5 times
I want to create a dashboard report with XY-Chart that uses input from my own database.
By just using SealLibrary.dll in my website, I don't want to use Report Designer desktop app.

Is there a demo code example for this? because i could not find anything in documentation or in https://sealreport.org/Recipes

I don't know how to load and create a connection to database and drawing of XY chart just using code.

Thanks in Advance
#2 Posted : Wednesday, February 3, 2021 7:26:58 AM(UTC)

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,001

Thanks: 14 times
Was thanked: 172 time(s) in 166 post(s)
There is no samples for this,
You have to check the objects model and API from https://sealreport.org/Help/Index.html
After creating the report, you have to add a Data Source, configure the Connection, then add a table, then add and configure elements from the added table columns to your report model...
A new recipe would be nice to show this...

Check also the code from TestsAndSamples project:
        public void CreationAndExecution()
            var repository = Repository.Create();
            Report report = Report.Create(repository);
            report.DisplayName = "Sample Report";
            var source = report.Sources.FirstOrDefault(i => i.Name.StartsWith("Northwind"));
            //Update the data source with a new table
            var table = source.AddTable(true);
            table.DynamicColumns = true;
            table.Name = "products";
            //Instead of the name, could be a direct SQL statement:
            //table.Sql = "select * from products";

            //Set the source of the default model
            report.Models[0].SourceGUID = source.GUID;
            //Add elements to the reports model
            foreach (var column in table.Columns)
                var element = ReportElement.Create();
                element.MetaColumnGUID = column.GUID;
                element.Name = column.Name;
                element.PivotPosition = PivotPosition.Row;
                element.Source = source;

            //Add a restriction to the model
            var restriction = ReportRestriction.CreateReportRestriction();
            restriction.Source = report.Models[0].Source;
            restriction.Report = report;
            restriction.Model = report.Models[0];
            restriction.MetaColumnGUID = table.Columns.FirstOrDefault(i => i.Name == "products.ProductName").GUID;
            restriction.Operator = Operator.Contains;
            restriction.Value1 = "er";
            //Set the restriction text
            if (!string.IsNullOrEmpty(report.Models[0].Restriction)) report.Models[0].Restriction = string.Format("({0}) AND ", report.Models[0].Restriction);
            report.Models[0].Restriction += ReportRestriction.kStartRestrictionChar + restriction.GUID + ReportRestriction.kStopRestrictionChar;

            //Then execute it
            ReportExecution execution = new ReportExecution() { Report = report };
            while (report.IsExecuting) System.Threading.Thread.Sleep(100);
            string result = execution.GenerateHTMLResult();

Edited by user Wednesday, February 3, 2021 7:28:43 AM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.