Data in one row

Stimulsoft Reports.WEB discussion
raj07
Posts: 21
Joined: Fri Feb 13, 2009 1:16 am
Location: Mumbai

Data in one row

Post by raj07 »

i want my data in one row means if i have 4 or 5 rows in my table it would print lik
eg. Raj,Mahesh,Ketan,Hitesh i need to print my data with comma seprator..

plzz do replyy..
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Data in one row

Post by Edward »

Hi,

Please declare string type variable in the Dictionary, i.e. MyVariable

There are methods in any DataSource in the Dictionary which help you to find a solution on this:

Code: Select all

MyVariable = null;
while (!MyDataSource.IsEof) 
{
if (MyVariable != null) MyVariable += ",";
  MyVariable += MyDataSource.MyDataColumn;
MyDataSource.Next();
}

You can place this code in the BeforePrint event of the Page, DataBand or StiText component.

Thank you.
raj07
Posts: 21
Joined: Fri Feb 13, 2009 1:16 am
Location: Mumbai

Data in one row

Post by raj07 »

can u explain this code in VB.NET i need to write it in VB.NET

thanxxx for the reply..
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Data in one row

Post by Edward »

Hi.

Here you are:

Code: Select all

MyVariable = Nothing
MyDataSource.First()
While Not MyDataSource.IsEof
if Not(MyVariable is Nothing) Then MyVariable = MyVariable+ ","
MyVariable = MyVariable + MyDataSource.MyDataColumn.ToString()
  MyDataSource.Next()
End While
MyVariable must be declared in the report's Dictionary.

Thank you.
raj07
Posts: 21
Joined: Fri Feb 13, 2009 1:16 am
Location: Mumbai

Data in one row

Post by raj07 »

Hii Edward Thanxx 4 Reply :biggrin:

but at which part of coding or.. where I write this CODE

MyVariable = Nothing
MyDataSource.First()
While Not MyDataSource.IsEof
if Not(MyVariable is Nothing) Then MyVariable = MyVariable+ ","
MyVariable = MyVariable + MyDataSource.MyDataColumn.ToString()
MyDataSource.Next()
End While

in my VB file or in .mrt Code file... tell me...
I dont no where to pass this Lines of code... plzz explain... it..
Thank You
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Data in one row

Post by Jan »

Hello,

You can place this code in GetValueEvent of text box:

Code: Select all

MyVariable = Nothing
MyDataSource.First()
While Not MyDataSource.IsEof
if Not(MyVariable is Nothing) Then MyVariable = MyVariable+ ","
MyVariable = MyVariable + MyDataSource.MyDataColumn.ToString()
MyDataSource.Next()
End While

e.Value = MyVariable 
Thank you.
raj07
Posts: 21
Joined: Fri Feb 13, 2009 1:16 am
Location: Mumbai

Data in one row

Post by raj07 »

Thanx Jan.. but in .mrt file I couldnt make changes ., modifying is not possible in .mrt file...
so where i put this code
can u explain it with me Example if possible..
Thanx for Reply...
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Data in one row

Post by Jan »

Hello,

Sorry i don't understand! You can't change report?

Thank you.
raj07
Posts: 21
Joined: Fri Feb 13, 2009 1:16 am
Location: Mumbai

Data in one row

Post by raj07 »

Hi..

currently i am getting data in this Format

Categorey Name : Beverages

Condiments

Confections

Dairy Products

Grains/Cereals

Meat/Poultry

Produce

Seafood

=========
but.......

i want to print it in this Format

Categorey Name : Beverages , Condiments , Confections , Dairy Products , Grains/Cereals , Meat/Poultry , Produce , Seafood

=========
This is my code in .mrt File

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

Namespace Reports

Public Class Report
Inherits Stimulsoft.Report.StiReport

Public Sub New()
MyBase.New
Me.InitializeComponent

End Sub


#Region "StiReport Designer generated code - do not modify"
Public Page1 As Stimulsoft.Report.Components.StiPage
Public Categories As Stimulsoft.Report.Components.StiDataBand
Public lblTo As Stimulsoft.Report.Components.StiText
Public txtCategories As Stimulsoft.Report.Components.StiText
Public Page1_Watermark As Stimulsoft.Report.Components.StiWatermark
Public Report_PrinterSettings As Stimulsoft.Report.Print.StiPrinterSettings
Public StyleStyle1 As Stimulsoft.Report.StiStyle
Public DataSource1 As DataSource1DataSource

Public Sub lblTo__GetValue(ByVal sender As Object, ByVal e As Stimulsoft.Report.Events.StiGetValueEventArgs)
e.Value = "Categorey Name :"
End Sub

Public Sub txtCategories__GetValue(ByVal sender As Object, ByVal e As Stimulsoft.Report.Events.StiGetValueEventArgs)
e.Value = ToString(sender, DataSource1.CategoryName, true)
End Sub

Private Sub InitializeComponent()
Me.DataSource1 = New DataSource1DataSource
Me.NeedsCompiling = false
Me.EngineVersion = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2
Me.ReferencedAssemblies = New System.String() {"System.Dll", "System.Drawing.Dll", "System.Windows.Forms.Dll", "System.Data.Dll", "System.Xml.Dll", "Stimulsoft.Controls.Dll", "Stimulsoft.Base.Dll", "Stimulsoft.Report.Dll"}
Me.ReportAlias = "Report"
'
'ReportChanged
'
Me.ReportChanged = New DateTime(2009, 3, 25, 9, 16, 37, 273)
'
'ReportCreated
'
Me.ReportCreated = New DateTime(2009, 2, 2, 2, 31, 55, 0)
Me.ReportGuid = "fd7ae59263e04a9e93f1efafaca8d64f"
Me.ReportName = "Report"
Me.ReportUnit = Stimulsoft.Report.StiReportUnitType.Inches
Me.ScriptLanguage = Stimulsoft.Report.StiReportLanguageType.VB
'
'Page1
'
Me.Page1 = New Stimulsoft.Report.Components.StiPage
Me.Page1.Guid = "a3db59b015814636a703d14e9015bf80"
Me.Page1.Name = "Page1"
Me.Page1.PageHeight = 11.69
Me.Page1.PageWidth = 8.27
Me.Page1.PaperSize = System.Drawing.Printing.PaperKind.A4
Me.Page1.Border = New Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.None, System.Drawing.Color.LightGray, 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black))
Me.Page1.Brush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Transparent)
'
'Categories
'
Me.Categories = New Stimulsoft.Report.Components.StiDataBand
Me.Categories.ClientRectangle = New Stimulsoft.Base.Drawing.RectangleD(0, 0.2, 7.49, 0.3)
Me.Categories.DataSourceName = "DataSource1"
Me.Categories.MaxHeight = 0
Me.Categories.MinHeight = 0
Me.Categories.Name = "Categories"
Me.Categories.Sort = New System.String(-1) {}
Me.Categories.Border = New Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.None, System.Drawing.Color.Black, 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black))
Me.Categories.Brush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Transparent)
'
'lblTo
'
Me.lblTo = New Stimulsoft.Report.Components.StiText
Me.lblTo.ClientRectangle = New Stimulsoft.Base.Drawing.RectangleD(0.1, 0.1, 1.5, 0.2)
Me.lblTo.LinesOfUnderline = Stimulsoft.Base.Drawing.StiPenStyle.None
Me.lblTo.MaxSize = New Stimulsoft.Base.Drawing.SizeD(0, 0)
Me.lblTo.MinSize = New Stimulsoft.Base.Drawing.SizeD(0, 0)
Me.lblTo.Name = "lblTo"
Me.lblTo.ProcessingDuplicates = Stimulsoft.Report.Components.StiProcessingDuplicatesType.Merge
AddHandler Me.lblTo.GetValue, AddressOf Me.lblTo__GetValue
Me.lblTo.Type = Stimulsoft.Report.Components.StiSystemTextType.Expression
Me.lblTo.Border = New Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.None, System.Drawing.Color.Black, 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black))
Me.lblTo.Brush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Transparent)
Me.lblTo.Font = New System.Drawing.Font("Arial", 11.25!)
Me.lblTo.Guid = Nothing
Me.lblTo.Margins = New Stimulsoft.Report.Components.StiMargins(0, 0, 0, 0)
Me.lblTo.TextBrush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black)
Me.lblTo.TextFormat = New Stimulsoft.Report.Components.TextFormats.StiGeneralFormatService
Me.lblTo.TextOptions = New Stimulsoft.Base.Drawing.StiTextOptions(false, false, false, 0!, System.Drawing.Text.HotkeyPrefix.None, System.Drawing.StringTrimming.None)
'
'txtCategories
'
Me.txtCategories = New Stimulsoft.Report.Components.StiText
Me.txtCategories.ClientRectangle = New Stimulsoft.Base.Drawing.RectangleD(1.8, 0.1, 2.4, 0.2)
Me.txtCategories.LinesOfUnderline = Stimulsoft.Base.Drawing.StiPenStyle.None
Me.txtCategories.MaxSize = New Stimulsoft.Base.Drawing.SizeD(0, 0)
Me.txtCategories.MinSize = New Stimulsoft.Base.Drawing.SizeD(0, 0)
Me.txtCategories.Name = "txtCategories"
AddHandler Me.txtCategories.GetValue, AddressOf Me.txtCategories__GetValue
Me.txtCategories.Border = New Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.None, System.Drawing.Color.Black, 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black))
Me.txtCategories.Brush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Transparent)
Me.txtCategories.Font = New System.Drawing.Font("Arial", 10!)
Me.txtCategories.Guid = Nothing
Me.txtCategories.Margins = New Stimulsoft.Report.Components.StiMargins(0, 0, 0, 0)
Me.txtCategories.TextBrush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black)
Me.txtCategories.TextFormat = New Stimulsoft.Report.Components.TextFormats.StiGeneralFormatService
Me.txtCategories.TextOptions = New Stimulsoft.Base.Drawing.StiTextOptions(false, false, false, 0!, System.Drawing.Text.HotkeyPrefix.None, System.Drawing.StringTrimming.None)
Me.Categories.DataRelationName = Nothing
Me.Categories.Guid = Nothing
Me.Categories.MasterComponent = Nothing
Me.Page1.ExcelSheetValue = Nothing
Me.Page1.Margins = New Stimulsoft.Report.Components.StiMargins(0.39, 0.39, 0.39, 0.39)
Me.Page1_Watermark = New Stimulsoft.Report.Components.StiWatermark
Me.Page1_Watermark.Font = New System.Drawing.Font("Arial", 100!)
Me.Page1_Watermark.Image = Nothing
Me.Page1_Watermark.TextBrush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.FromArgb(50, 0, 0, 0))
Me.Report_PrinterSettings = New Stimulsoft.Report.Print.StiPrinterSettings
'
'StyleStyle1
'
Me.StyleStyle1 = New Stimulsoft.Report.StiStyle
Me.StyleStyle1.Name = "Style1"
Me.StyleStyle1.Border = New Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.None, System.Drawing.Color.Black, 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black))
Me.StyleStyle1.Brush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Gainsboro)
Me.StyleStyle1.Font = New System.Drawing.Font("Arial", 8!)
Me.StyleStyle1.TextBrush = New Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black)
Me.PrinterSettings = me.Report_PrinterSettings
Me.Page1.Page = me.Page1
Me.Page1.Report = Me
Me.Page1.Watermark = me.Page1_Watermark
Me.Categories.Page = me.Page1
Me.Categories.Parent = me.Page1
Me.lblTo.Page = me.Page1
Me.lblTo.Parent = me.Categories
Me.txtCategories.Page = me.Page1
Me.txtCategories.Parent = me.Categories
'
'Add to Categories.Components
'
Me.Categories.Components.Clear
Me.Categories.Components.AddRange(New Stimulsoft.Report.Components.StiComponent() {me.lblTo, me.txtCategories})
'
'Add to Page1.Components
'
Me.Page1.Components.Clear
Me.Page1.Components.AddRange(New Stimulsoft.Report.Components.StiComponent() {me.Categories})
'
'Add to Pages
'
Me.Pages.Clear
Me.Pages.AddRange(New Stimulsoft.Report.Components.StiPage() {me.Page1})
'
'Add to Styles
'
Me.Styles.Clear
Me.Styles.AddRange(New Stimulsoft.Report.StiBaseStyle() {me.StyleStyle1})
Me.DataSource1.Columns.AddRange(New Stimulsoft.Report.Dictionary.StiDataColumn() {New Stimulsoft.Report.Dictionary.StiDataColumn("CategoryID", "CategoryID", "CategoryID", GetType(Integer)), New Stimulsoft.Report.Dictionary.StiDataColumn("CategoryName", "CategoryName", "CategoryName", GetType(String)), New Stimulsoft.Report.Dictionary.StiDataColumn("Description", "Description", "Description", GetType(String)), New Stimulsoft.Report.Dictionary.StiDataColumn("Picture", "Picture", "Picture", GetType(System.Byte()))})
Me.DataSources.Add(Me.DataSource1)
Me.Dictionary.Databases.Add(New Stimulsoft.Report.Dictionary.StiOleDbDatabase("Data", "Data", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Stimulsoft Reports."& _
"Net 2008.2 Trial\Bin\Data\NWIND.MDB;Persist Security Info=False", false))
AddHandler Me.DataSource1.Connecting, AddressOf Me.GetDataSource1_SqlCommand
End Sub

Public Sub GetDataSource1_SqlCommand(ByVal sender As Object, ByVal e As System.EventArgs)
Me.DataSource1.SqlCommand = "select * from categories"
End Sub

#Region "DataSource DataSource1"
Public Class DataSource1DataSource
Inherits Stimulsoft.Report.Dictionary.StiOleDbSource

Public Sub New()
MyBase.New("Data", "DataSource1", "DataSource1", "", true, false, 30)
End Sub

Public Overridable ReadOnly Property CategoryID As Integer
Get
Return CType(StiReport.ChangeType(Me("CategoryID"), GetType(Integer), true),Integer)
End Get
End Property

Public Overridable ReadOnly Property CategoryName As String
Get
Return CType(StiReport.ChangeType(Me("CategoryName"), GetType(String), true),String)
End Get
End Property

Public Overridable ReadOnly Property Description As String
Get
Return CType(StiReport.ChangeType(Me("Description"), GetType(String), true),String)
End Get
End Property

Public Overridable ReadOnly Property Picture As Byte()
Get
Return CType(StiReport.ChangeType(Me("Picture"), GetType(System.Byte()), true),Byte())
End Get
End Property
End Class
#End Region 'DataSource DataSource1
#End Region 'StiReport Designer generated code - do not modify
End Class
End Namespace

in this code i could'nt make changes so can u show me where I
put the code u have suggested me

MyVariable = Nothing
MyDataSource.First()
While Not MyDataSource.IsEof
if Not(MyVariable is Nothing) Then MyVariable = MyVariable+ ","
MyVariable = MyVariable + MyDataSource.MyDataColumn.ToString()
MyDataSource.Next()
End While

e.Value = MyVariable

Now u get the Idea what i am talking about...

plzz i need it so if u can do it...
Thank You.


Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Data in one row

Post by Jan »

Hello,

I understand what the problem. Please look on attached image.

Thank you.
Attachments
156.Sample.png
156.Sample.png (98.33 KiB) Viewed 6442 times
Post Reply