Crystal Report referring to xsd file - crystal-reports

I am trying to create a crystal report, but I want the connection string that I have mentioned in the Web.Config file to be accessed. Also, I want to create an xsd file for my crystal report file to refer. Can someone please direct me to a tutorial or forum to solve my problem?

Thank you all for helping me out.
I am now able to display data in the crystal report file using the XSD file.
The xsd file has fields which are exactly the same name as mentioned in the select query that is bringing values from DB.
The following is the part of the xsd file that contains the field names in the xs:element tag.
The datatypes of these fields , also needs to be mentioned. The XSD file name can be kept as desired.
The name "Summary_Report_on_portal" and "Summary_Updt" does not correspond to any dataset name in code behind or query fields. It can be kept as per the user's wish.
This XSD file needs to be referred into the crystal report, using the Database Expert in the Field Explorer window. The "Summary_Updt" name is visible in the new connections , which can be added to the crystal report.
The fields mentioned in the xs:element field are visible for the user to drag and drop into the crystal report.
When the user mentions the data source to the crystal report(dataset), the fields in the dataset are matched with the XSD field values.
CODE:
objBL.Rpt.SetDataSource(objBL.ds_shipment_info.Tables[0]);
Hope this is detailed enough. Let me know if anyone wants more info

you can also programatically set the report data source if you need to - I can provide details if you require
between calling myReportDocument.Load("myreport.rpt") and myReportDocument.Refresh() (the latter of which actually gets the data from the database) it is possible to add a call to myReportDocument.SetDataSource(myDataSource) which takes an object of data source type, which you can create, with a call to its constructors, with the URL of the data source you wish to use, its username and password.
Hope this helps

a different way would be to call ReportDocument::SetDatabaseLogon (String * user, String * password, String * server, String * database); before Refresh(); if you don't want to reuse a connection. This has the benefit of being simple but means that you dont reuse data sources.

Related

Why does my tableau tooltip get changed when I change my data source?

I am moving from a csv to a postgresSQl for my tableau workbook. Both of them have the same field names, exact data types. However, when I change my data source the tooltip gets a random text which breaks the filter in the toolip viz
I tried replacing the csv file with the same csv file and the same thing happened. So I think this is a tableau issue and not a database issue
<Sheet name="Tooltip: Level 2 Site Scores" maxwidth="300" maxheight="300" filter="<Site>,<[federated.02mez2l0u2i0o018sk45f0skmrv7].[none:level_2:nk]>"> (This is what happens)
<Sheet name="Tooltip: Level 2 Site Scores" maxwidth="300" maxheight="300" filter="<Level 2>,<Site>"> (This is what I want)
The 'Level 2' field gets messed up for some reason
If you open Tableau desktop file in a text editor, you'll see that it's an XML. In an example, I have a file with the following line. Tableau assigns a unique id to calculated fields I create, this is the "Calculation_104990228446113793"
<column-instance column='[Calculation_104990228446113793]' derivation='None' name='[none:Calculation_104990228446113793:nk]' pivot='key' type='nominal' />
The same can be seen for data source references.
<datasource caption='my_data_source' inline='true' name='federated.0dbu8r50hqicaj1fm4f2b1r4o814' version='10.5'>
So when you swap a data source, unique id's change and cause the error you're seeing. Not sure if your issue is a bug or not, you could report it. But this is what is happening in your case.

Insert URL into BIRT Report that contains dynamic parameters

I am fairly new to BIRT and I am working on adding some new functionality to one of our existing reports.
We have an application that makes a call to BIRT to generate the report in question. When this report is generated I would like to include a URL at the bottom of the report.
The only issue is that the URL would contain two parameters that are different for each report that gets generated. I created a data source and a data set that I can pull the parameters from, but I am not sure how to create a URL with the parameters that relate to the particular report that is being generated.
I have read that you can create a label and insert a hyperlink, but this doesn't seem to be of much help in my situation.
The URL that gets inserted into the report would need to look as follows:
localhost:8080/Application?key=firstParameter&securityString=secondParameter
Please let me know if I did not explain my situation thoroughly or if you need more clarification.
Best Regards,
-Dave
There are multiple ways to do this.
For example insert a new "Data" element to the report, set the datatype to "String" and enter as expression the text you want to display, i.e. "My URL" (with quotes because it is an expression).
Then click on "Binding" tab of this data element and select your dataset. Answer no to the question "Do you want to clear existing binding". In the popup, select all columns required to build the URL.
Finally use hyperlink property of the data element. May be you missed it can be an expression:
This pops up an expression builder, in your case this would result in something like:
"localhost:8080/Application?key="+row["firstParameter"]+"&securityString="+row["secondParameter"]

Using Select query, nothing merges onto Crystal report

I have a Crystal template that I am modifying in developer because we are changing the datasource from an Access file to our Oracle DB. I created a database field that accurately connects to Oracle and added a select statement that because pulls a field from a particular table
select s.field from table s;
On the right hand side, under database fields, I see my command and can right click and browse the data, which right now returns two values.
I also made a formula field using an Azalea barcode function that calls the values (I think, this is where stuff is going wrong, I guess)
The formula field is
BarcodeC39ASCII({Command.field})
So this should take the data and format it into the barcode, except when I use print preview or print out the report, no data is merged.
I've tested this by creating a new formula field with just the Command.field, and still no data is merged. I imagine there is something really obvious that I am missing and would appreciate any input.
So unless I misunderstood your question, you are changing your datasource from Access DB to Oracle DB, correct? Assuming that the database structure remains the same then all you should need to do is go into Database -> Set Datasource Location and set the datasource location from the Access DB to the Oracle DB and your existing report should work as it did. You might have to map some fields, but that should be the extend of it. Is that what you are trying to do?
Chris

Jasperreport parameter selection from SQL query

I wanted to create a JasperReport which asks the user for a deliverer before it creates a report with data of the last the deliveries of the selected deliverer.
The problem, how I can do that? I found only examples where a parameter is created and the ArrayList is filled statically. But in my parameter I need the query result over the table of deliverers filled.
Can anybody tell me a possible solution?
I'm using Jaspersoft Server 5.1 which directly access a PostgreSQL database which has a datawarehouse structur. So it's not possible to use Java code.
Here is the documentation for adding input controls to reports in JasperReports Server:
http://community.jaspersoft.com/documentation/jasperreports-server-user-guide/adding-input-controls
Scroll down to the section that deals with query-based input controls. Your input control will have a name, such as deliverer. In your report, you must add deliverer as a parameter and reference it in your query, as you have done in your comment.

Create Formula Field that Lists All Tables In Crystal Report

I am looking for a way to create a formula field that will list out the table names of all tables that are being utilized as data sources in a Crystal Report.
I have not found any function that provides that capability in the application yet.
This would be used to put the list of tables as a supplemental for those users that do not have access to the report file but need to know what tables are used in the report.
It seemed better to do this as dynamically as possible - instead of having to provide a static list of current tables linked into the report.
Thanks.
Unfortunately, this type of functionality isn't present in Crystal Reports.
You might be able to use a UFL to solve the problem. General idea:
pass path of current report to UFL (the Filename function will give you this)
open the referenced report using the Crystal Reports SDK and examine the tables in DataDefintion class; the DatabaseFieldDefinition.UseCount will help determine if a field (and hence table) is referenced in the report
return the table names as a string array (note: CR only supports 1-dimensional arrays w/ a maximum of 1000 elements)
create a formula field to call the UFL's function; Join() the string array (formula fields can't return an array):
Join(GetRptTables(Filename), ",")
distribute the UFL with the .RPT
Another option, if you have BusinessObjects Enterprise and a spare $40K, is Metadata Manager; this will give you a holistic view of your organization's reporting deployment.