Ordering in CrossDataBand?

Stimulsoft Reports.NET discussion
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Ordering in CrossDataBand?

Post by amitkaushik »

Hi,

I have to pass parameters to dataSource in an order like "2,4,8,5" and looking to print report in same as "2,4,8,5".
With the help of CrossDataBand report generated proprerly but its change the order of report like "8,5,2,4".

Is there any property to print report as it is we pass perameter to DS.

One more thing is per. is veriant and only one peremeter is used here for more then one records.

Regards
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Ordering in CrossDataBand?

Post by HighAley »

Hello.

Please, try to remove any sorting. By default the data should be shown in the same order.
If it will not help, send us your report template with sample data.

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: Ordering in CrossDataBand?

Post by amitkaushik »

Thanks,

But no sorting I use with this report and it work fine for 3 ids but get fail on 4.
Attachments
Report.mrt
(20.35 KiB) Downloaded 393 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Ordering in CrossDataBand?

Post by HighAley »

Hello.

Please, send us a sample data for your report and a step-by-step instruction how to reproduce it.

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: Ordering in CrossDataBand?

Post by amitkaushik »

Hi,

Here I supply peremeter '1,2,3,4' but the output in report is '3,4,1,2'.
what i require here same order as peremeter passed. example (4,2,1,3) or (1,4,3,2)

How Cross Data Band order the data supplied by DataSourse?

create TABLE [dbo].[Product](
[ProductID] [int] IDENTITY(1,1) NOT NULL,
[ProductName] [varchar](50) NOT NULL,
[CompantName] [varchar](50) NOT NULL
)

insert into [dbo].[Product] values('Prod1','Comp1')
insert into [dbo].[Product] values('Prod2','Comp2')
insert into [dbo].[Product] values('Prod3','Comp3')
insert into [dbo].[Product] values('Prod4','Comp4')
insert into [dbo].[Product] values('Prod5','Comp5')

--------------------------------------------------------------------------

Create FUNCTION [dbo].[Split]
(
@RowData varchar(8000),
@SplitOn nvarchar(5)
)
RETURNS @RtnValue table
(
Id int identity(1,1),
Data varchar(8000)
)
AS
BEGIN
Declare @Cnt int
Set @Cnt = 1
While (Charindex(@SplitOn,@RowData)>0)
Begin
Insert Into @RtnValue (data)
Select Data = ltrim(rtrim(Substring(@RowData,1,Charindex(@SplitOn,@RowData)-1)))
Set @RowData = Substring(@RowData,Charindex(@SplitOn,@RowData)+1,len(@RowData))
Set @Cnt = @Cnt + 1
End
Insert Into @RtnValue (data)
Select Data = ltrim(rtrim(@RowData))
Return
END

---------------------------------------------------------------------------
alter PROCEDURE [dbo].[sp_Product_Info]
@ProductID varchar(MAX)
AS

DECLARE @ProductIDcount int
SELECT @ProductIDcount = COUNT(*) FROM dbo.Split(@ProductID ,',')

DECLARE @Table TABLE( ProductID int, ProductName Varchar(max),[CompantName] Varchar(max));

DECLARE @intFlag INT, @ProdID int, @RowCount int

SET @intFlag = 1
WHILE (@intFlag < = @ProductIDcount)
BEGIN
SELECT @ProdID = data FROM dbo.Split(@ProductID , ',') where Id = @intFlag

select @RowCount = Count(*) FROM [dbo].[Product]
WHERE ProductID = @ProdID

if(@RowCount > 0)
begin
INSERT @Table
SELECT DISTINCT ProductID, [CompantName], ProductName
FROM [dbo].[Product]
WHERE ProductID = @ProdID
End
else
begin
INSERT @Table VALUES (@ProdID, '','')
end
SET @intFlag = @intFlag + 1
END
SELECT * FROM @Table

GO
Attachments
Report.mrt
(19.62 KiB) Downloaded 411 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Ordering in CrossDataBand?

Post by Alex K. »

Hello,

Please remove the sorting from GroupHeaderBand components.

Thank you.
Attachments
Capture.PNG
Capture.PNG (86.83 KiB) Viewed 2909 times
Report2.mrt
(19.69 KiB) Downloaded 198 times
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: Ordering in CrossDataBand?

Post by amitkaushik »

Thankyou. :)
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Ordering in CrossDataBand?

Post by Alex K. »

Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: Ordering in CrossDataBand?

Post by amitkaushik »

Yes I need one more help.
When I have only three product it leave the space blank for 4th product.
what i want to do here is, complete width of page filled by 3 products in equal width and no blank space left here.

Thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Ordering in CrossDataBand?

Post by Alex K. »

Hello,

You can use the DockStyle property and additional code in BeforePrint event.
Please check the modified report in attachment.

Thank you.
Attachments
Report3.mrt
(21.28 KiB) Downloaded 438 times
Post Reply