I am writing a Crystal report with 2 separate queries - one using DB2 database and one using a SQL database. I linked the queries together using a field, though I did have to convert the data type on one so it could be linked (not sure if this is relevant).
The DB2 query is giving me all of my customer data displayed on the report, including a customer ID. The only thing I'm pulling from the SQL DB is the same customer ID, just from another table. If the customer ID from the DB2 query is found in the customer ID list from SQL, I do not want to display that customer record.
First, I created a formula called "CustID" like this:
if {Command.Customer_ID} = {Command1.Customer_ID} then "True" else "False"
I then wrote a Record for Select Expert like this:
{#CustID} = "False"
This is giving me no records returned at all. I feel like I have a lapse in my logic somewhere but I can figure out where. Thanks in advance.
Related
For my College assignment, I have to create a database in Access, I have done 99% of my database, apart from this section which I'm stuck on.
In my DB, I have a tickets table, which contains records on order information and a field containing a date. For my assignment, I have to create a Form which reads from a Query.
For example, in my Form i have already created i have 2 Combo boxes with the dates already pulled from the Query. I need to be able to drop down one of the boxes and input 1 date, and then drop down the other box and select a different date, press a button and it generate me a Report.
The part I am asking for help on is the expression which is used to look up the data inside the Query. I tried using this expression, which Access said was too complicated.
[Forms]![frmOrdersBetweenTwoDates]![Combo33] And [Forms]![frmOrdersBetweenTwoDates]![Combo36]
My full SQL query is:
SELECT tblTickets.CustomerID, tblCustomers.FullName, tblCustomers.AddressLine1, tblTickets.OrderNumber, tblTickets.OrderDate
FROM tblCustomers INNER JOIN tblTickets ON tblCustomers.[CustomerID] = tblTickets.[CustomerID]
WHERE ((("WHERE [OrderDate]") Between [Forms]![frmOrdersBetweenTwoDates]![Combo52] And [Forms]![frmOrdersBetweenTwoDates]![Combo54]));
My expression/query now returns the report, but there is no data inside the report. How could i fix this?
Cheers.
Should post the complete query statement. Expect the filter clause should be like:
WHERE [date fieldname] BETWEEN [Forms]![frmOrdersBetweenTwoDates]![Combo33] AND [Forms]![frmOrdersBetweenTwoDates]![Combo36]
However, I don't use dynamic parameterized queries. I prefer to use the WHERE argument of OpenReport (same for OpenForm), in VBA:
DoCmd.OpenReport "report name", , , "[date fieldname] BETWEEN #" & Me.Combo33 & "# AND #" & Me.Combo36 & "#"
I have a table with a GUID column and a recordId (not a guid) column. I need my report to accept a GUID as a report parameter and use it as part of the Record Selection formula to make certain the report only get the record Id's it needs.
[Linking Table] -> [Detail Containing Table]
Since the report doesn't support passing a GUID parameter directly, I was able to convert the GUID to a string and pass it in without incident. When I generate the SQL query in Crystal Designer it looks good: The WHERE clause is properly formatted and if I run the query in SQL Designer it will find all the records I need to fetch. Actually attempting to display the report fail however, it states that 0 records were found despite SQL Profiler also showing that the same SQL was fired off.
Has anyone run into this issue? Is there any way to get the Record Selection formula to not drop the records when actually displaying the report?
After working with SAP Support we were able to determine that there is a defect in 14.0.11. The SQL Query was being formatted correctly, but the record linking under the hood was using a different (and incorrect) linking order. Since the database results and internal schema wound up with different starting tables, Crystal discarded the results to prevent exceptions.
Going to Database Expert -> Links -> Order Links and checking the 'Link Ordering is Enforced' box forced the engine to use the same link ordering throughout the report in the proper order. Then the SQL query and internal record schema matched and we got records.
What I'm trying to do:
I have a report already created that looks for something existing in one database and not in another. 99% of the time the report comes up empty. We do not need to know when there are no results to show. I only want to know when the query returns a result.
What I've done so far:
I have a the Data Source created and a table (view) created to where I can query for Subscriber information.
What I hope can be answered:
Is it all possible to have this report run and email my selected Subscribers only when there is data in the output?
I see you've already looked into Data-Driven subscriptions. You should be able to write your query in the data-driven subscription to test if the report should return results, and if not, send it to a dummy address, and only send it to your subscriber list if there will be data in it.
If you put the dummy address in your table with an IsDummy flag column, you could do something like this:
SELECT [EmailTo]
FROM SubscriptionTable
WHERE IsDummy=0
AND (SELECT COUNT(*) FROM SomeTable)>0 --report should have results
UNION ALL
SELECT [EmailTo]
FROM SubscriptionTable
WHERE IsDummy=1
AND (SELECT COUNT(*) FROM SomeTable)=0 --report should not have results
And that's only one way, there are probably lots of other ways that might suit your needs as well or better.
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
We are using reports in our web application.
The report is generated using JasperReports.
The problem I am facing is:
My SQL query fetches data based on a where clause:
SELECT * FROM table WHERE level='c'
I can easily show this information inside the iReport.
But I need to fire another query where level='d' and the information for the same needs to be appended to the report with that of level='c'.
I tried grouping both the outputs. But problem is how do I fire two different query while generating the report because I can write only one query in QueryBuilder inside the iReport.
Is there anyway of achieving the same.
In essence:
The report should look like:
Level=C
Name Age Phone number
Level=D
Name Age Phone number
Level D should appear only after level c is completed.
Can anyone please guide.
I finally managed to achieve the same..Grouping the data using level_id..
Initially I was trying to group in a different manner and hence the value was not getting shown..
The same is explained pretty nicely in ireport Ultimate guide-3 document.