Crystal Reports Paramteres - crystal-reports

My report is working in Crystal Reports designer, but when I am adding it into the Sage Sales logix it doesnt sends the parameter values to database and errors out.
I am using a command like this in the report
exec('select * from testingmyreportfunction({?Param1},{?Param2})')

Assuming that you created the parameters in command window use this query:
// Oracle
SELECT testingmyreportfunction({?Param1}, {?Param2})
FROM dual
// SQL Server
SELECT testingmyreportfunction({?Param1}, {?Param2})

Related

Use query SQL in Crystal report

I have a complicated SQL in Excel to generate a raw data table for report from SQL server OLEDB . I would like to use Crystal Report to generate a neat and formatted report. I can use the Excel raw data table as the Crystal report database data source. But, Excel need to be refreshed every time new report is required. How can I use the Excel SQL command text string to be Crystal Report data source?
My Excel connect string: Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=MicrosoftDynamicsAX;Data Source=SQL2;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=RD04;Use Encryption for Data=False;Tag with column collation when possible=False
I have Crystal report version 8.5 and 11.
Its simple
While creating the connection dont select tables instead use add command and then paste the query in the box and use in reports

Create Report using Crystal Report XI from DataSet

*STEP 1.*My program get Crystal Report (XI sp6) templates from admin. It parses the templates to get SQLs from that and then populate it to get DataTables for each SQL.
*STEP 2.*After that, it push the DataTables back into the ReportDocument to create the report by using the following code:
// there no subreport in our template
//mainDS include all populated DataTable having the same name of related CR Command Alias
foreach (Table tab in doc.Database.Tables)
tab.SetDataSource(mainDS.Tables[tab.Name]);
The problem is (I wonder if it is a Crystal Report Bug): if there is 2 Command in the template, when the code tab.SetDataSource(mainDS.Tables[tab.Name]); is executed for doc.Database.Tables[0] then doc.Database.Tables[1].Fields is become the same to doc.Database.Tables[0].Fields and ofcause I get an error.
I do not get this error with all templates, just some :(. All templates worked well in Crystal Report GUI!!!
Please help if it not bug or please show me how to work around!
I am using Crystal Report XI Developer Edition with latest pack, VS2005. Oracle 10g, Devart DotConnect for Oracle Free version.
After mining SAP document and test many times, I think that it is a bug of CR XI R2 sp6. So I on report I only keep 1 Command, If there is a need for other commands, I will create subreports and put the commands in these.

Crystal Report 2008 Add Command Where Clause parameter

Crystal Version - Crystal Reports 2008 Business Objects - XI
I have written a query to populate a subreport and want to pull in a parameter to that query based on input from a user. My question is, what is the correct syntax I need to put in the first line of the 'Where' clause to accept the parameter?
I created a parameter in Add Command it is called PickDate
Here is the query I am using in Crystal Reports:
select
table2.book_no,
table2.time_stamp,
table2.restdate,
a.timestamp,
a.event_type,
a.status,
a.people,
a.new_date,
a.comments,
a.operator_id
from table1 a, table2
where table1.book_no = table2.outage_no
I have tested the query, it is pulling all the data, now I just need help adding parameter to prompt user to enter datatime.
Did you try using the Select Expert in the subreport? You should be able to say field = {?PickDate}

how to display the current username in crystal report?

how to display the current username who executes the report in crystal report,
i have tried using CurrentCEUserName for displaying the current username, but it is not working. can anyone suggest me how to get this username into the report.
The CurrentCEUserName grabs the current username from the credentials that are used when connecting to the Business Objects Repository Server.
If you are looking to get the current user from a SQL Server that connects using Windows Authentication you will have to return the username value from the SQL Server to the Crystal Report.
e.g
Select SUser_SName() as [CurrentUser],
Column1,
Column2,
etc..
From dbo.YourTable

Crystal Reports XI with Oracle Function wm_concat()

Within Crystal Reports XI I'm trying to have a SQL Expression Field with Oracle 10g function wm_concat(column_name). It appears that Crystal Reports XI is not handling this function properly. If I execute the function wm_concat() within the database, it works fine, however, when trying to use it in Crystal Reports it displays a blank page. Whats interesting is that this field is within a sub-report, yet the whole report displays as a blank page.
Crystal Reports can tell at design-time that this function is valid (It doesn't let you save the SQL Expression if its not valid). So its a runtime error. I have also tested using various Oracle functions such as TO_CHAR() and REPLACE() and these all work fine with Crystal Report SQL Expressions. Any ideas?
WM_CONCAT isn't a built-in function, and isn't necessarily installed with a database.
You could try WMSYS.WM_CONCAT, as the function is actually owned by the WMSYS schema.
You may need to add a specific grant. By default, if it is there, it has EXECUTE granted to PUBLIC but your DBA may have revoked that and replaced it with specific grants.
I couldn't get WM_CONCAT to work; Since the queries execute flawless in Oracle, but not in Crystal Reports I would assume it is something within Crystal Reports. I ended up having to make a PL/SQL Stored Procedure and call it from the Crystal Report. I called the Stored Procedure from a SQL Expression Field within Crystal Reports.