Combine multiple columns containing similar values into one column for use in graph inside Crystal Reports - crystal-reports-xi

I have 3 fields, Action1, Action2 and Action3 contained in one report. Each Action field is selected from the same list of values. I would like to graph a count of these values by the value of the field and not field itself. I need one graph and not one graph per Action field. I have tried to combine the field values into an array in the details section, but the report shows the concatenated string values "Action1, Action2, Action3', as a single value in the graph. I tried to graph using "on change of", but it will only allow 2 fields and not 3. Is there a way to count these values regardless of the Action field where they are found?
I have been working with Crystal for years, but can't figure this out for whatever reason.

I was never able to find a solution to this issue inside of Crystal Reports itself. What I ended up doing was creating a stored procedure in SQL to use as the data source. In the stored procedure I basically performed a cross join such that there was only 1 Action returned per record. In CR I then was able to summarize the Action field values.

Related

SSRS Only Showing 1 Instance of Report, Expecting Multiple

I'm new to SSRS so forgive me if this is an obvious answer. I'll try and simplify my problem as best I can:
I have a report that's based off of a query. On that report it has the fields Account ID and Mail Date from that query on the page. Not a tablix, just the fields.
When I run the query on the DB, it will return 100 records, so 100 distinct Account ID and Mail Date pairs.
When I run the report, I only get one instance of the report, the very first Account ID/Mail Date pair. I was expecting 100 instances of the report, one for each the Account ID/Mail Date pairs (that's how it worked in Oracle Forms, which I'm trying to convert).
Is there a configuration or setting I'm missing to get the expected behavior?
Thanks.
I see a few people have viewed this so here's the solution I used:
I created another report with my dataset, put a table on that report, set it break after each record, then put a subreport on the table that contained the original report and passed all the dataset values from the table to the subreport.
The subreport was then created with 1 record per page as I wanted.

Delphi Combo Edit from CSV File

I have an application that will load a CSV file containing two columns. At program load I need to have the first column as items in a combo edit control. Once the user selects (or enters a value) I need to populate a label with the value from the second column. My thought was to use an in memory data set, FDMemTable which would be loaded at form create. Then once the user selects, or enters an item, I would run a query to pull the description. I've tried but have been unsuccessful with the simple loading of the combo edit.
Is this the best way to achieve the desired results, and is there samples similar to what I'm looking to do?
Read the file.
Parse it into an array of name/value pairs.
Populate the combo drop down list with the names.
When the combo's selection is changed to a new index, read the value from the array using that index. Update the label.
Database tables and queries seem somewhat over the top for a single simple task like this.

Hyperlink from a count query to extract associated data in access

I have a Count query that uses multiple criteria to produce a result looking like:
count ID
1 "abc"
4 "bcd"
5 "def"
1 "cde"
This shows how many times the ID appears in a given database. The datasource is through an odbc connection that updates automatically. So the ID values change everytime it is opened. I would like to try to turn the unique ID or the associated count into a hyperlink that when clicked will return all information involved in the count (*note the database has much more information associated with the ID's than is counted, a date range of the previous three months is applied.) Can this be done simply?
Database format:
ID Instance Device DateBeg DateEnd
Thanks in advance,
LP
The short version -
This should be simple to do using a report (but could also be done using a form I will be explaining how to do a report for this version). You would just make a report that includes all of your fields then call the report on click. It is important to mention that you will need to view the query via a form to make this work.
A more detailed version -
The first step will be to make a form based on your query (you will not be able to do this directly from a query). To do this select your query then click on the create tab then click Multiple Items Form. Adjust as needed.
Then create a report that shows ALL of the records how you want it to display. (I will call it rpt_ViewDetails) (we will limit later)
When you are done adjusting click on the field that contains the "abc" etc. results (if this is a calculated field it will be more complicated.) I will call this field "Criteria" for the example. Go to the events tab on the property sheet (in design view). use the On Dbl Click event and go to code builder.
This is what the code would look like (place in between the private sub.... and the end sub lines of code):
DoCmd.OpenReport "frm_ViewDetails", acViewNormal, , "[Criteria] = " & Me.Critera
Let me know if you have any trouble with this, also let me know if the structure is different than I am assuming, I will need a more detailed report of what the query is doing if this is the case, what the structure of the database is etc.

Multiple field values to subreport error

I have a parent report that feeds one of the field values into a subreport. But the problem is that there this field value can include multiple records. For simplicity, assume that this field value is called color, where possible values might be orange, red, and green. I need to pass all of these value to the subreport, not just one. I have tried passing the values this way into the Color parameter of the subreport:
=Fields!Color.Value
But this doesn't work and gives me an error. I have also tried:
=join(Fields!Color.Value,",")
This also gives me an error on the subreport
I have also tried both of the above as an expression in a textbox in the parent report and I get #Error displayed on the parent report. I was able to successfully get just the first value to appear by using a similar expression and the First function. But I am not able to get all of the values to display in this textbox on the parent report? how can I do this or at least pass all of the values to this subreport?
The easy solution is if Color is already a parameter - I would pass this expression in the subreport:
=Parameters!Color.Value
If Color is not a parameter, I would add a column to the driving dataset in the parent report using a SELECT ... FOR XML to concatenate the relevant Color values together. Then you can pass that field to the subreport.

Crystal Reports parameterized queries

The company I work for is using MacolaES for an ERP system. The SQL Server database is structured such that when things are no longer considered active, they are moved from a set of "active" tables to a set of "history" tables. This helps to keep the "active" tables small enough that queries return quickly. On the flip side, the history tables are enormous. The appropriate columns are indexed in these tables, and if you query for something specific it returns quickly.
The problem is when you make a Crystal Report, which is prompting the user for a parameter. For reasons not known to me, Crystal parameters are not translated into SQL parameters, so you end up with queries selecting everything from the order header history table inner joined to everything in the order lines history table, which results in over 8 million rows.
Is there a way to get Crystal Reports to use the parameters in the SQL query instead of loading all the records and filtering after the fact? I read somewhere that a stored procedure should work, but I'm curious if an ordinary parameterized query is possible in the interest of saving my time.
Here is the selection formula:
(
trim({Orderheader.ord_no}) = {?Order No}
)
and
(
{Orderheader.ord_type} = 'O'
)
and
(
{orderlines.ord_type} = 'O'
)
In Crystal Reports top menu go to Report / Selection Formulas / Record... There you can add a formula similar to:
{table.field1} = {?Parameter1} and {table.field2} = {?Parameter2}
That will add the condition to the where statement of the SQL query that the report will use to pull the rows.
To verify what is the condition in the where statement that the report is using to pull the data you can go to the menu database / Show SQL Statement. That way you can verify that the report is using the parameters in the filter.
Crystal Reports 8.5 User Guide mention the following tips:
To push down record selection, you
must select “Use Indexes or Server for
Speed” in the Report Options dialog
box (available on the File menu).
In record selection formulas, avoid data
type conversions on fields that are
not parameter fields. For example,
avoid using ToText( ) to convert a
numeric database field to a string
database field.
You are able to push down some record selection formulas
that use constant expressions.
Your formula has a TRIM function on a field. The function against the field does not allow Crystal to push the formula to the database because is not a constant expression.
If you really need to trim the order number field you should do it using SQL Expressions.
References:
Check out this article.

Resources