Wednesday, March 7, 2012

Desperate for help.......

I want to incorporate fields from 2 tables in a single crystal report.I have no problems in incorporating from a single table. But when it comes to >1 table fields in a single report, I am stuck up..

For eg.:

Table 1 :"GENINFO"
-------
custno | mail id
--------

Table 2 :"DETAILS"
--------
custno | Listofcompaniesowned
----------

Now, I would like to write the RECORDSELECTIONFORMULA as part of the code,without using the editor.

I intend the user to choose the customer he wants to see, based on a customer number that he will provide.

Report.DataDefinition.RecordSelectionFormula = "{GENINFO.custno}=" &i
[i is a variable which takes userinput for customerno.]

Report.DataDefinition.RecordSelectionFormula = "{DETAILS.custno}=" & i

This doesnot work...
The first problem is how to couple these both...tables in the formula.

I used "And". ...doesn't work..

The second problem is that I want only custno field from GENINFO table to be part of my report.The custno field of DETAILS table is just meant for selecting the other fields in the table such as "listofcompniesowned" etc...
----------------
CrysReport1.rpt
----------------
custno | GENINFO.CUSTNO
mailid | DETAILS.MAILID
listofcompniesowned | DETAILS.LISTOFCOMPNIESOWNED
----------------
----------------

I tried dataset for this...by creating xsd file, but it gives me a "query engine error"......in a "c:/......./......./temp/......................rpt file".

I could not understand what it is this error all about ??

In general, please guide me as to the ways of using more than 1 table in a single report?//

Fast Replies welcome.

Thanks for the time.First of all, why are you trying to control the whole record selection formula from your VB.NET code? Why don't you just pass the value of "i" as a parameter to the CrystalReport and then your record selection formula would be something like this:

{GENINFO.custno}= <?i>

As far as linking the tables you should do that in your CrystalReport under Database>Visual Linking Expert. If you are only pulling data from 2 tables there really is no need to use datasets. DataSets make your report slower.

In many of my reports I pass all kinds of parameters like that and it works just fine.

No comments:

Post a Comment