Greetings and thanks for taking time to read my question.
I have been tasked with creating a web interface for a set of existing
Crystal .RPT files. I have to use Crystal 8 and am interfacing with
the report options using the VBScript within ASP. I have everything
complete with the interface but I must set the grouping options.
My .RPT file has 2 Group Headers.
Group Header #1 switches between Queue.Number and Queue.Name (where
Queue is the name of a table and Number and Name are fields within the
Queue table).
Group Header #2 switches between Agent.Number and Agent.Name (again,
Agent is a table and Number and name are fields within the Agent
table).
I own the Peck book "The Complete Reference, Seagate Crystal Reports
8" and followed an example and directions in his book. From within the
Crystal Report Designer I looked under "Insert | Database Field" and
saw that the Agent Table was the first on the list, and Queue was the
seventh. Within the Queue table, Number is the 4th field and Name is
the 6th. Within the Agent table Number is the 8th field and Name is
the 10th. So, following his example, I would issue the following
command to group my report by Queue Number and Agent Number:
' Set Group Header #1 to sort by Queue.Number
Set oGroupField = session("oRpt").Database.Tables(7).Fields(4) ' Queue.Number
Set oGroupArea = session("oRpt").Areas("GH1") ' Group Header #1?
oGroupArea.GroupConditionField = oGroupField
' Set Group Header #2 to sort by Agent.Number
Set oGroupField = session("oRpt").Database.Tables(1).Fields(8) ' Agent.Number
Set oGroupArea = session("oRpt").Areas("GH2") ' Group Header #2?
oGroupArea.GroupConditionField = oGroupField
I have done each of them independently and neither work. Both will throw the error:
Error -2147191765 There is an error in this formula. Please edit it
for more details.
If I comment out:
oGroupArea.GroupConditionField = oGroupField
Then the reports run fine (without the Grouping working).
I believe Crystal 8.5 allows you to group by name instead of this
ridiculous Tables(Index).Fields(Index) method but I cannot go to
Crystal 8.5.
I figure that either my Tables(Index) Index number is wrong or the
Fields(Index) Index number is wrong. The example in the Peck book only
had 1 Table. I am pretty sure the Index number for the Fields portion
is based upon where the fields are located in the Database Fields view
under the Designer application, but I am not as certain about the
index number for the Table. The Database Fields view lists the Tables
in alphabetical order. I believe the index however is based upon the
order in which the Tables were added to the .RPT file (I don't have
any documentation to this effect, but that is how it numbers the
indexes for the Formula Fields).
I think I am in the right ballpark, if someone could steer me in the
right direction I certainly would appreciate it! |