Create extra DataObject in Sharp-Shooter in Galaxy

In this thread we will see how can create an extra DataObject to ours sharp shooter report in Galaxy
Suppose that we want to make labels and repeat them any times that we want
First off all we must make a standalone filter in Report Designer , named that fAntitypa
After that in design of Sharp Shooter :

In Import property of Document properties insert below references
SLnet.Base.Interfaces
SLnet.Sand.Base.Views
SLnet.Sand.Schema

After that write below script in General Script property


Int16 Antitypa ;
System.Data.DataTable dtSerials = new System.Data.DataTable();
System.Data.DataColumn dcSerialNumber = new System.Data.DataColumn();
dcSerialNumber.ColumnName = «SerialNumber»;
System.Data.DataColumn dcDescription = new System.Data.DataColumn();
dcDescription.ColumnName = «Description»;
dtSerials.Columns.AddRange(new System.Data.DataColumn[]{dcSerialNumber,dcDescription});

System.Data.DataRow drrowSerial;
slsSchemaFilterModel fm = (slsSchemaFilterModel) Document.Engine.Objects[«Filters»];
Antitypa = Convert.ToInt16(fm.GetFilterValue(«fAntitypa», SLnet.Sand.Base.Interfaces.slsFilterModelFilterKin d.Value));
System.Data.DataSet serials = Document.Engine.Objects[«SerialNumbers»] as System.Data.DataSet;

for (int i = 1; i <= Antitypa; i++)
{
foreach (System.Data.DataRow dr in serials.Tables[0].Rows)
{
drrowSerial = dtSerials.NewRow();
drrowSerial[0] = dr[«Serialnumber»].ToString();
drrowSerial[1] = dr[«Description»].ToString();
dtSerials.Rows.Add(drrowSerial);
}
}

DataObjects.Add(«TSerialNumbers», dtSerials);

Let’s look some parts of this script

First create a data table and add some data columns with prefer names

The next 3 rows are very important

With this command take all filters that create in report designer
slsSchemaFilterModel fm = (slsSchemaFilterModel) Document.Engine.Objects[«Filters»];

With this command take value from filter fAntitypa that create before in report designer
Antitypa = Convert.ToInt16(fm.GetFilterValue(«fAntitypa», SLnet.Sand.Base.Interfaces.slsFilterModelFilterKin d.Value));

With this command take dataset from Report Definition (root name of tables definition)
System.Data.DataSet serials = Document.Engine.Objects[«SerialNumbers»] as System.Data.DataSet;

After that fill ours table with values from a table of Report definition so many times that declare at fAntitypa
Now we create a new DataObject named TSerialNumbers and assign our table that created before
After that in Databand that we want assign new DataObject in property DataSource declare new DataObject
Waiting for your comments and clarifications want.
Happy conding !!!Wink

Αφήστε μια απάντηση

Η ηλ. διεύθυνση σας δεν δημοσιεύεται. Τα υποχρεωτικά πεδία σημειώνονται με *

Αυτός ο ιστότοπος χρησιμοποιεί το Akismet για να μειώσει τα ανεπιθύμητα σχόλια. Μάθετε πώς υφίστανται επεξεργασία τα δεδομένα των σχολίων σας.