I am writing some code that analyses the 700+ Crystal reports we have within our business. I am aiming to have this code evalaute the data access code for each report. I have managed to determine whether the report is using a Command, Stored Procedure or Table access to obtain the data. However, when I am retrieving the SQLQueryString property of the Report I seem to be having an adverse affect on the msdb database on our SQL Server. It appears to be causing some locking issues. Is there any other method of obtaining the SQL Command code from the Crystal Objects?In your Front End application, check if there is any property to get query
Something like
CR.GetQuery
Showing posts with label writing. Show all posts
Showing posts with label writing. Show all posts
Sunday, March 25, 2012
Crystal Reports Syntax
I am not really a programmer but I am writing a report in CR XI and I am having syntax issues. I need some sort of operator after my 'then' statement (See code below) "Else" only works on the first line. I tried "And" or "Or" does not work. Can someone please help!!!!
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} IN 100 TO 199 Then 'Cash' - need function
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} IN 200 TO 299 Then 'Short Term Investments' need fuction
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} in 300 To 399 Then 'Account Receivables'
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} In 500 To 599 Then 'Fixed Assets'
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} In 600 To 699 Then 'Long Term Investment'okay I figured it out, instead of using If.... Then statements there is a command call "switch" that you can use for all true values. My report is now done YEAH!!!!!|||u can also use :
If .... then
elseif ...... then
else
endif
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} IN 100 TO 199 Then 'Cash' - need function
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} IN 200 TO 299 Then 'Short Term Investments' need fuction
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} in 300 To 399 Then 'Account Receivables'
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} In 500 To 599 Then 'Fixed Assets'
If {REPORT_LINE.SECTION_NUMBER} = 1 and {REPORT_LINE.LINE_NUMBER} In 600 To 699 Then 'Long Term Investment'okay I figured it out, instead of using If.... Then statements there is a command call "switch" that you can use for all true values. My report is now done YEAH!!!!!|||u can also use :
If .... then
elseif ...... then
else
endif
Monday, March 19, 2012
Crystal Report to Default Printer
Hi,
We're writing in Crystal 8.5 and I'd like to know how to direct a report to a user's default printer. A report can be distributed to several locations or printers.
Thanks in advanceYou can make use of CR's printer collection
CR.printer='PrinterName'
We're writing in Crystal 8.5 and I'd like to know how to direct a report to a user's default printer. A report can be distributed to several locations or printers.
Thanks in advanceYou can make use of CR's printer collection
CR.printer='PrinterName'
Wednesday, March 7, 2012
Crystal Mandatory Fields
Hiya,
I'm writing a crystal report linking with an Access Database.
basically I need to say If Address line1 = "" then display section A if not, do nothing,
but I have to do this for about 30 fields, How would i go about doing this?
Basically, it picks up data from the database,If everything is filled in when the report is run, the report orints out fine, if something is blank or a null value then it will pick up details section B which will say "The following fields need to be filled in" and then it will list the fields?
Any ideas
Thanksif you want to suppress whole section A if addressline ="" then right click on section A -> format section -> there is a button beside suppress text click on it and write down:
if addressline ="" then true else false
It will suppress that section and if you want to suppress some fields only then you have write this on each and every field in design view and for that you have to right click on that field -> formate field -> and here also same you have to write "if addressline ="" then true else false" in suppress button script.
Best of Luck|||better use
if isnull(addressline) then
true
else
false
I'm writing a crystal report linking with an Access Database.
basically I need to say If Address line1 = "" then display section A if not, do nothing,
but I have to do this for about 30 fields, How would i go about doing this?
Basically, it picks up data from the database,If everything is filled in when the report is run, the report orints out fine, if something is blank or a null value then it will pick up details section B which will say "The following fields need to be filled in" and then it will list the fields?
Any ideas
Thanksif you want to suppress whole section A if addressline ="" then right click on section A -> format section -> there is a button beside suppress text click on it and write down:
if addressline ="" then true else false
It will suppress that section and if you want to suppress some fields only then you have write this on each and every field in design view and for that you have to right click on that field -> formate field -> and here also same you have to write "if addressline ="" then true else false" in suppress button script.
Best of Luck|||better use
if isnull(addressline) then
true
else
false
Thursday, February 16, 2012
Cross Tab Query giving erros
Hi,
I'm having a problem while writing cross tab queries. The fact is I'm getting errors when I execute the query.
The query is as follows.
SELECT skill_Id,
count(CASE final_rating WHEN 5 THEN assoc_name ELSE 0 END) AS "5",
count(CASE final_rating WHEN 4 THEN assoc_name ELSE 0 END) AS "4",
count(CASE final_rating WHEN 3 THEN assoc_name ELSE 0 END) AS "3",
count(CASE final_rating WHEN 2 THEN assoc_name ELSE 0 END) AS "2"
FROM viewfinalrating
GROUP BY skill_id
My purpose is to get the count of the assoc_name for each final_rating grouped by skill_id. When I execute the above query I'm getting the error
Server: Msg 245, Level 16, State 1, Line 1
Syntax error converting the varchar value 'Name1' to a column of data type int.
Name1 is an assoc_name in the view viewfinalrating. Why is SQL server trying to convert the assoc_name to int. Isn't the query supposed to get the count of assoc name based on the CASE statements?
What could be the problem?
Thanks in advance
Regards,
P.C. VaidyanathanWhen you use CASE statments you must return like data types. You need to change the "ELSE 0" to a "ELSE '0'" or "Null". However if you change you approach just a bit I think you can achive your goal...
Try
------------------------------
SELECT skill_Id,
sum(CASE final_rating WHEN 5 THEN 1 ELSE 0 END) AS "5",
sum(CASE final_rating WHEN 4 THEN 1 ELSE 0 END) AS "4",
sum(CASE final_rating WHEN 3 THEN 1 ELSE 0 END) AS "3",
sum(CASE final_rating WHEN 2 THEN 1 ELSE 0 END) AS "2"
FROM viewfinalrating
GROUP BY skill_id
----------------------------
I'm having a problem while writing cross tab queries. The fact is I'm getting errors when I execute the query.
The query is as follows.
SELECT skill_Id,
count(CASE final_rating WHEN 5 THEN assoc_name ELSE 0 END) AS "5",
count(CASE final_rating WHEN 4 THEN assoc_name ELSE 0 END) AS "4",
count(CASE final_rating WHEN 3 THEN assoc_name ELSE 0 END) AS "3",
count(CASE final_rating WHEN 2 THEN assoc_name ELSE 0 END) AS "2"
FROM viewfinalrating
GROUP BY skill_id
My purpose is to get the count of the assoc_name for each final_rating grouped by skill_id. When I execute the above query I'm getting the error
Server: Msg 245, Level 16, State 1, Line 1
Syntax error converting the varchar value 'Name1' to a column of data type int.
Name1 is an assoc_name in the view viewfinalrating. Why is SQL server trying to convert the assoc_name to int. Isn't the query supposed to get the count of assoc name based on the CASE statements?
What could be the problem?
Thanks in advance
Regards,
P.C. VaidyanathanWhen you use CASE statments you must return like data types. You need to change the "ELSE 0" to a "ELSE '0'" or "Null". However if you change you approach just a bit I think you can achive your goal...
Try
------------------------------
SELECT skill_Id,
sum(CASE final_rating WHEN 5 THEN 1 ELSE 0 END) AS "5",
sum(CASE final_rating WHEN 4 THEN 1 ELSE 0 END) AS "4",
sum(CASE final_rating WHEN 3 THEN 1 ELSE 0 END) AS "3",
sum(CASE final_rating WHEN 2 THEN 1 ELSE 0 END) AS "2"
FROM viewfinalrating
GROUP BY skill_id
----------------------------
Subscribe to:
Posts (Atom)