leannekarlich
MIS
Hi
I am using VB 6 and have just migrated to Crystal 10 from 8.5.
An original VB interface b/t our system & Crystal failed logon when used with Crystal 10.
BO Help Desk advice was to convert from API to RDC, which is where I am now.
Basically the VB reads a parameter file to determine the RPT and its criteria, applies the criteria to the RPT, connects to a db and displays the report.
Currently I'm trying to include code that will allow detail line sort fields to be set in the rpt file.
As per Crystal Developer’s Help, "Adding a new sort field to a report".
As the VB program has to cope with dozens of reports, I cannot use a fixed field position as per the example.
I thought I had coded an equivalent and didn't get errors, but I also didn't get the results I expected.
In my test the RPT has no sort fields defined, but I was attempting to add 1 to the report detail section.
An extract of my code is as follows:
Dim CRXReport As New CrystalReport1
Dim CRXDatabaseField As CRAXDRT.DatabaseFieldDefinition
Private Sub Form_Load()
NextSortField% = 0
NbrSortFields% = CRXReport.RecordSortFields.Count
If NbrSortFields% > 0 Then
NextSortField% = NbrSortFields% + 1
Else
NextSortField% = 1
End If
For CCount% = 1 To SortCount%
CRXDatabaseField = SortArray$(2, CCount%)
If Val(SortArray$(3, CCount%)) = 1 Then
CRXReport.RecordSortFields.Add CRXDatabaseField, crAscendingOrder
Else
CRXReport.RecordSortFields.Add CRXDatabaseField, crDescendingOrder
End If
Next CCount%
CRViewer1.ReportSource = CRXReport
CRViewer1.ViewReport
End Sub
The content of SortArray$(2, CCount%) is {STRDEPRT.DEPT_CODE} which is a field in the report detail line.
When I view the content of CRXDatabaseField it reveals no assignment which corresponds with the report not sorting by this field.
Hoping someone can help
Leanne
I am using VB 6 and have just migrated to Crystal 10 from 8.5.
An original VB interface b/t our system & Crystal failed logon when used with Crystal 10.
BO Help Desk advice was to convert from API to RDC, which is where I am now.
Basically the VB reads a parameter file to determine the RPT and its criteria, applies the criteria to the RPT, connects to a db and displays the report.
Currently I'm trying to include code that will allow detail line sort fields to be set in the rpt file.
As per Crystal Developer’s Help, "Adding a new sort field to a report".
As the VB program has to cope with dozens of reports, I cannot use a fixed field position as per the example.
I thought I had coded an equivalent and didn't get errors, but I also didn't get the results I expected.
In my test the RPT has no sort fields defined, but I was attempting to add 1 to the report detail section.
An extract of my code is as follows:
Dim CRXReport As New CrystalReport1
Dim CRXDatabaseField As CRAXDRT.DatabaseFieldDefinition
Private Sub Form_Load()
NextSortField% = 0
NbrSortFields% = CRXReport.RecordSortFields.Count
If NbrSortFields% > 0 Then
NextSortField% = NbrSortFields% + 1
Else
NextSortField% = 1
End If
For CCount% = 1 To SortCount%
CRXDatabaseField = SortArray$(2, CCount%)
If Val(SortArray$(3, CCount%)) = 1 Then
CRXReport.RecordSortFields.Add CRXDatabaseField, crAscendingOrder
Else
CRXReport.RecordSortFields.Add CRXDatabaseField, crDescendingOrder
End If
Next CCount%
CRViewer1.ReportSource = CRXReport
CRViewer1.ViewReport
End Sub
The content of SortArray$(2, CCount%) is {STRDEPRT.DEPT_CODE} which is a field in the report detail line.
When I view the content of CRXDatabaseField it reveals no assignment which corresponds with the report not sorting by this field.
Hoping someone can help
Leanne