|
-
Aug 10th, 2009, 09:42 AM
#1
Thread Starter
Addicted Member
Selection Formula and booleans
I am developing a small application which requires a bit of reports. I use crystal reports together with vs/vb 2008 and access 2007 for the db. In my report I filter the data using a combobox and using in code the selection formula to get the needed results. This is what I do:
Code:
CrystalReportViewer1.SelectionFormula = "{AllServices.Technicians} = 'james'"
CrystalReportViewer1.RefreshReport()
When I use strings to filter like the above one no problem. When I try to filter data according to a column which stores boolean values of '0' and '-1' I get the weirdest error message. Here it is:
A boolean is required here.
Error in File
C:\Users\KORNHO~1\AppData\Local\Temp\temp_e03b07bf-5711-4899-8a7d-2bf7312d5a3b
{CDE41268-7151-4C31-AECA-BB6A47341221}.rpt:
Error in formula <Record_Selection>.
'{AllServices.Completed} = '0''
A boolean is required here.
This is the code I use when I get this:
Code:
CrystalReportViewer1.SelectionFormula = "{AllServices.Completed} = '-1'"
CrystalReportViewer1.RefreshReport()
It says that a boolean is needed here and a boolean I am using. I have google it, forumed it, read about it but nothing to assist me. Anyone has any hints on what is going wrong? Thanks for the replies
-
Aug 10th, 2009, 10:13 AM
#2
Re: Selection Formula and booleans
Anything wrapped in single or double quotes is a String.
"{AllServices.Completed} = -1"
But in previous versions of Crystal you had to use the words (ie constants) True or False, so if the above doesn't work obviously try
"{AllServices.Completed} = True"
-
Aug 17th, 2009, 06:02 AM
#3
Thread Starter
Addicted Member
Re: Selection Formula and booleans
Using True worked and remove a bit of the problem. I was testing the application using access 03 and your solution worked. When I moved to access 07 then this selection formula leaves me with no data on the report. Any suggestions?
ps. How can you undo the selection formula filter?
How do you run and fill the report on runtime? Anyone has any link/tutorial on how to do this?
Thank you all very much
Last edited by gate7cy; Aug 18th, 2009 at 09:50 AM.
-
Sep 22nd, 2009, 09:31 AM
#4
Thread Starter
Addicted Member
Re: Selection Formula and booleans
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|