|
-
Apr 25th, 2006, 06:04 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Crystal Sort Order
Can anybody see why the following code doesn't work. VB.Net doesn't grumble but it doesn't run the report and promptly exits the program without any errors. If I comment out the code it works fine.
The report already has two sort fields but I just need to change the sort order.
VB Code:
Dim sField1 As CrystalDecisions.CrystalReports.Engine.DatabaseFieldDefinition
sField1 = x.cr.Database.Tables.Item(0).Fields("sales_order")
x.cr.DataDefinition.SortFields.Item(0).Field = sField1
-
May 18th, 2006, 06:57 AM
#2
New Member
Re: Crystal Sort Order
Which CR version ?
In CR 11, I used this, and it works fine :
VB Code:
Call x.cr.RecordSortFields.Add(x.cr.Database.Tables(1).Fields.GetItemByName("sales_order"), crAscendingOrder)
Hope it'll help.
Nathy1210
-
May 18th, 2006, 03:53 PM
#3
Thread Starter
Addicted Member
Re: Crystal Sort Order
Thanks, I'll give it a try but I did get round it by using grouping.
VB Code:
Select Case CcbsCombo1.SelectedIndex
Case 0 'by line
Case 1 'by part
Dim grpline As CrystalDecisions.CrystalReports.Engine.FieldDefinition
grpline = x.cr.Database.Tables(0).Fields("order_line")
x.cr.DataDefinition.Groups(2).ConditionField = grpline
Dim grppart As CrystalDecisions.CrystalReports.Engine.FieldDefinition
grppart = x.cr.Database.Tables(0).Fields("part")
x.cr.DataDefinition.Groups(1).ConditionField = grppart
Case 2 'by bin
Dim grppart As CrystalDecisions.CrystalReports.Engine.FieldDefinition
grppart = x.cr.Database.Tables(0).Fields("part")
x.cr.DataDefinition.Groups(2).ConditionField = grppart
Dim grpbin As CrystalDecisions.CrystalReports.Engine.FieldDefinition
grpbin = x.cr.Database.Tables(0).Fields("bin")
x.cr.DataDefinition.Groups(1).ConditionField = grpbin
End Select
(I am using CR 11)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|