Dynamic Table Of Contents - CR - crystal-reports

I am currently using crystal reports to create a price list which MUST have a table of contents. The report is passed a dataset from a stored procedure, though I don't think anything I can do server-side will be able to achieve this.
What my question is really is, is there any way of finding what page a particular value in a group header is on, if I can do this I can obviously create an index page with dynamic page numbers easily.

Related

Relative Date Item in Power Pivot GETPIVOT DATA excel function

I am using a GETPIVOTDATA function in Excel to source data from a pivot table generated by a Power BI query (everything was originally only in excel, the file got too large, so i stored the main tables in PBI but kept the reports in excel for mgmt's sake).
=GETPIVOTDATA("[Measures].["&$A$100&"]",'PIVOT Table_test'!$A$126,"[Master].[field1]","[Master].[field1].&["&C$26&"]","[Master].[AsofDate]","[Master].[AsofDate].&[2022-04-30T00:00:00]")
However, I want to make the GETPIVOTDATA function as dynamic as possible to prevent having too many hardcoded fields/items for each table that fields the charts we look at. However, when i reference the pivot table, the '[Asof]' field populates the static item as "...&[2022-04-30T00:00:00]")...
I have been trying to change that to reference a header row that contains a Short Date value (4/30/2022) like &["&$B&1"&"]")... but i keep getting #ref errors, every other field accepts the "&&" method, and when i leave the hardcoded timestamp in the formula, it populates.
So it has to be that reference but i do not understand what I am doing wrong. I have also tried changing the format of both the header row in Excel and the field within PBI but to no success.
Found the answer on another site. The solution in the item brackets is to write the following:
["&TEXT($A22,"yyyy-mm-dd""T00:00:00""")&"]

Adding Signature Blobs to Crystal Report Form

New to Crystal Reports (2013) and learning by doing. I have a client agreement form that has five signature blob fields stored in a column in a separate table. I need to populate each of those five signatures into the correct spot on the form. I tried doing this with formula fields and I'm not having any luck. The field doesn't even show as an option under the SQL Expressions Fields options. If I try it as a regular formula field IF statement I get an error message that says blobs aren't allowed in formulas. If I just add the field to the report, it pulls in only the final signature as there's no conditional statements telling it which signature to grab. How do I go about creating a formula/field/object for each of the five signatures so I can place them on the form? In SQL I'd do a series of SELECT signature_blob WHERE signature_number = X but that doesn't seem to be an option that I'm finding.
Edit: so I think I've managed to do it like this by adding a new database command for each field, but is there a better way?
Create a database view that returns the 5 signatures as 5 columns and a single row + one column for the Agreement ID.
Add that View to the report and join (on Agreement ID).
You can do the same thing directly in the report without a View by adding the Signature table 5 times with different aliases and restrict each alias to a single signature. This would be the same logic as the database view but would be a bit slower.

Displaying multiple records in Crystal report as comma separated value

I have a view that I am using to display some information in Crystal report file. In some cases, view is supposed to return more than 1 record.
By default, in these cases, Crystal report take the last record and display that one. So, if I have two records with id A and B, I will see only the details of B.
I want to have an option where both A and B are displayed separated by comma.
E.g. if EmployeeDepartment in Employee table has two records (CIS, FINANCE) for employee A, then I want to see #EmployeeDepartment return "CIS, FINANCE" instead of just "FINANCE".
I have been trying to find a way to do this. Till now, I have gotten this far:
Base formula
Shared Stringvar store;
store:=store+{TBL_MR_Header.MRHD_Customer_Ref_No}+ ", "
Display formula
Shared Stringvar store;
store
When I run the report, base formula returns "B," instead of "A,B". Display formula on the other hand displays nothing.
I am unsure what I am missing here.
Edit:
I have created a query that returns the two value comma separated, in both records. So, both records display "CIS, FINANCE" instead of "CIS" and "FINANCE" respectively. Now, I have simple problem, how do I put this query in crystal report file? Only option I can find is to use that datasource expert tool but that does not allow updating query.
Edit:
I actually decided to go different route there. I tried putting the base formula in header and display formula in detail section, but that didn't work either. Turns out, one of my colleague tried a trick to solve similar problem. He used the C# code to call a T-SQL query, got the value in CSV format, and passed it as a parameter. It requires an extra trip to database, but it made it easier.

Crystal Report with multiple datasources

I am working on a crystal report like in the sample image. it has some limited attributes and some attributes that will be repeated. like item id will be repeated for each item and invoice id will be only one in the whole invoice. I am trying to use two different tables one for repeating elements and one for single time elements.
I am facing problem in setting the datasource of the crystal report. how can I set it so that it may fetch data for repeated elements from datatable one and other from datatable two.
Or if you know any other approach for such problem please share.
Problem Solved.
We can use as many datasources as we want. We just need to add them through database expert options.
besides while giving it actual data we can do that like this:
objRpt.Database.Tables[0].SetDataSource(list_of_objects_of_data_sources);
objRpt.Database.Tables[1].SetDataSource(list_of_objects_of_data_sources2);
this also shows that we can provide data to crystal report through list of obects instead of datatables. we just need to set the references in the database expert as those class objects.
like in the figure

Two SQL query inside single JasperReport

We are generating reports based on iReports and JasperReports for web application.
Using iReports I found I am struck with big problem.
I want to use two SQL query to fill up my main report...
In query designer I can only write one query..
For another query I cannot use sub-reports...
How do I write second query which will return different fields and include them in my report..
Please guide...
I cannot use sub-reports...
Yes, adding a table to your report is as easy as adding a field. Just drag it from the palette and drop it in the report where you need to have it.
Add a new Table data source. I assume this was done.
Once the data source is configured, you could design your table UI using the wizard.
just click on next or finish to close the wizard.
To add a parameter in data set (if needed), Navigate to your data set using the report inspector. Expand your data set. You would find the parameters menu. Right click to add the new parameter.
Now right click on your table and select edit table data source. Here you will find options to pass parameters to your table from the main report. Passing parameters to your table should be as simple as you do in sub reports. Select the parameter just created from the drop down list box and pass the required value.
In the Data set run Dialog box that appears, please make sure of the data set and the report connection you are using.
You are done configuring the table with this, next you will place the fields in the cells of table for displaying the data.
You are getting your document has no pages since the main report query does not return any rows i guess. For your table to be executed your main report must return at least a row
Hope this helps you.
Good Luck!!
As far as Ireports are concerned, the main report can comprise only one query. And if you wanna use multiple queries in your report, it is possible in the following ways.
Sub Report
Table Dataset.
sub Dataset.
since you don wish to use a sub report, you can go for a Table Dataset. Anything you would do with a sub report is possible with table dataset too(Except for returning variables). You can use sub datasets with charts and graphs. Table set will be of use to you i hope.