|
well i am a beginner at vb.net and has got stuck with a problem where i have to generate datatable dynamically and feedit into crystal report as a source.
i hve been able to build the data table but i dont know how to provide this data table tht i have generated as the input to the crystal report.
pease help me!
puneet shadija
|
|
|
Folllow the below steps.
1- Create a crystal report template(Add =>Add New Item => Crystal Report
2- Drop Crystalreportviewer control on from from toolbox.
3-do needful to create commandtext of commandbutton (select those fields which u specify in template)
4-And then assosiate ur commandtext with Crystalreportviewer.selectformula
i hope it will work fine
|
|
|
sir,
thanx for responding but my need is such that i dont have any fixed structure for the table... which is the datasource for my report. the choice made by the user defines the structure at the run time and the data is then filled into it. So, i need the API using which i can define the structure of the data to be shown at run time and put data which is there in my table into the detail section.
hoping for a positive response.
thank you
|
|
|
Have u got any solution, i have same problem
|
|
|
I have been trying to findmout how to generate a dynamic report in visual basic. I know how to design a database program and use crystal report or data report with dataenvironment. Really this does little compared to what i want. What i need is that when a user select the fields he/she wants to use or see i want those fields alone to be reported in the crystal report or data report. That is what i have been trying to find out. Please kindly help me if you can.
|
|
|
dear,
i haven't got answere to the problem i have mentioned above;
But the problem u are talking about if a lot different (if i was able to get it right!!!), what are the type of fields that you have and are those fields fixed in number... it would be better if u can give more explanations regarding your problem.
|
|
|
The dynamic report can be generated only using Formula Fields. i m using Crystal reports 10.0. Just add few formula fields into details section of the report. Now through VB or VB.NET, we can access Report's Formula Fields Array. The instance of the Report (.rpt) has a property "FormulaFields" as Array of the formula fields on the report, we can assign column names of a datatble to the FormulaField(index).Text property to have dynamically those columns onto the report.
The syntax will be:
ReportInstance.DataDefinition.FormulaFields(index).Text = "{DataTable.ColumnName}"
For Eg:
SalaryReport.DataDefinition.FormulaFields(0).Text = "{EmployeeSalaryTable.Sal}"
Thus the first formula field, that is added to the details section in report, will dhow the salary details.
|
|
|
Hi,
Dynamically, I have to bind XML file with crystal Report in c#.net.
If any body knows then let me know its very urgent.
|
|
|
Hello,
Thanks for ur code but it does not work for string. If we pass a string to any formula, it does not work.
|
|
|
|
|
If you want to pass an actual string just add ' ' around the text. ex :
SalaryReport.DataDefinition.FormulaFields(0).Text = "'passing this text'"
|
|
|
I'm very much new in vb most esp. with crystal reports. i'm creating a sort of report wizard wherein i need to create reports depending on the parameters or fields chosen by the user. What i want to do is to create reports dynamically, wherein my DATA SOURCE may be ALTERED , depending in the user. It's like a table with N-number of fields. I would really appreciate any help you could give. Thank you.
|
|
|
What if i dont have an exact number of fields? Will the formula fields work? Thanx
|
|
|
No you'll need either the number or the name of the feild itself.
you can loop throught all your feild and getting the feild name using the ReportInstance.DataDefinition.FormulaFields(0).Name command
ex:
Dim myFormulaField As CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition
Dim myName As String
For Each myFormulaField In ReportInstance.DataDefinition.FormulaFields
myName = myFormulaField.Name
... do what you want
Next
or you can type
ReportInstance.DataDefinition.FormulaFields("feildname").text = "'passed in'"
but make sure you have the correct feild name. For the dynamic report generation you could pass a dataset to the report all you have to do different is instead of connecting the report to a database you assign it a dataset in .Net "ReportInstance.SetDataSource(myDataSet)" . Another way if you prefer is to create a temporary table that you will use for your reports.
|
|
|
Thank you very much for the reply... I tried creating a temporary table. i'm using VB 6.0 and Crystal 6. I created a <.ttx> table using Data Definitions and i have transferred ol fields that i'll be needing. My problem is i have no exact number of fields to view on my report. It leaves me to creating so many temporary fields, assuming the maximum number of fields on my report. Can i design my temporary table during runtime? Thank you...
|
|
This 45 message thread spans 3 pages: [1] 2 3 > > |