Print Page | Close Window

filtering reports

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4126
Printed Date: 08 May 2024 at 3:21pm


Topic: filtering reports
Posted By: cardpogi
Subject: filtering reports
Date Posted: 01 Sep 2008 at 9:12am
im recieving an error message when i try to filter a report on my website project : error message is as follows..
This field name is not known. Error in File C:\WINDOWS\TEMP\rptOrientacionesUsuario {81E783E3-FE97-4126-B09E-AA96E01DA869}.rpt: Error in formula . ' {SISAA.MAESTRO_USUARIOS_SIAL.NOMBRES} = ' ' ' This field name is not known.
 
my code is the following:
 
string selectFormula = " {MAESTRO_USUARIOS_SIAL.NOMBRES} = ' " + Class1.globaluser + " ' ";
            CrystalReportViewer1.SelectionFormula = selectFormula;
where MAESTRO_USUARIOS_SIAL.NOMBRES is the table and field im trying to filter by, and Class1.globaluser is a global string which contains the parameter I wish to filter by. any idea?



Replies:
Posted By: BrianBischof
Date Posted: 01 Sep 2008 at 11:01am
The problem is the "SISAA." in your formula. The formula you show in C# doesn't have the "SISSAA." in it. Somehow I think there is a disconnect between your C# code and Crsytal Reports. Somehow the "SISSAA." is sneaking into yoru report and you have to figure out how that is happening.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: cardpogi
Date Posted: 01 Sep 2008 at 11:12am
no.. im sorry that was a none refreshed error messaeg.. the error message i do get is this...
 
This field name is not known. Error in File C:\WINDOWS\TEMP\rptOrientacionesUsuario {E7322BDD-77D8-4784-8EDC-1F7201B3E73E}.rpt: Error in formula . ' {MAESTRO_USUARIOS_SIAL.NOMBRES} = ' ' ' This field name is not known.


Posted By: BrianBischof
Date Posted: 01 Sep 2008 at 11:43am
Ok. If that's the case, then the field isn't recognized by Crystal. The part before the "." is the table name and the part after the "." is the field name. The error message means that either the table name is wrong or the field name is wrong. You have to make sure that your datasource has both the table and field names available for printing.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: cardpogi
Date Posted: 01 Sep 2008 at 11:54am
yeah that what i find ackward.. because where the field parameters is from that table and that field, i use a drop down box, to select the field i need and then im trying to filter it through the selectionformula.. :(


Posted By: cardpogi
Date Posted: 01 Sep 2008 at 12:01pm

maybe there is an error in my formula syntax? but i cant seem to find it...



Posted By: cardpogi
Date Posted: 01 Sep 2008 at 12:52pm
any ideas?


Posted By: BrianBischof
Date Posted: 01 Sep 2008 at 1:14pm
The error states that the field name is not known. For some reason it isn't recognizing the name of the table or the field. Both that is all I can tell you from the error message given. Sorry.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: cardpogi
Date Posted: 01 Sep 2008 at 2:59pm
because look at the syntax on the error... is that right? {MAESTRO_USUARIOS_SIAL.NOMBRES} = ' ' ' is that = supposed to be there?


Posted By: BrianBischof
Date Posted: 01 Sep 2008 at 3:47pm
The last ' is there because CR surrounds the error message with single quotes.
 
What about this, change the formula to hard-code a value you know is in the field. That way you test to see if that works at all.
string selectFormula = " {MAESTRO_USUARIOS_SIAL.NOMBRES} = ' 'Jones'";
Oh yeah - here is how I debug formulas. I FIRST create the formula with Crsytal Reports and make it the way I want it. SECOND, I run the program and go into debug mode. Then I print the formula in debug mode to see how CR stores it internally. I make sure that my formula matches EXACTLY with ZERO variation. Once I get that working, then I can tweak it by adding in variables from my program and make sure that it continues to work each step of the way.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: cardpogi
Date Posted: 02 Sep 2008 at 6:54am
awwwwww...  for some reason I didnīt check the forum earlier.... aww... but I ended up doing the same thing as you told... just that it took me couple of hours.. but after i solved that... i get this error... XD
 
A number, currency amount, boolean, date, time, date-time, or string is expected here. Error in File C:\WINDOWS\TEMP\rptOrientacionesUsuario {F203355C-ECA3-4C97-9F25-C10ECF53A6B2}.rpt: Error in formula . '{MAESTRO_USUARIOS_SIAL.NOMBRE} = Administrador del sistema SISAA' A number, currency amount, boolean, date, time, date-time, or string is expected here.
 
string selectFormula = "{MAESTRO_USUARIOS_SIAL.NOMBRE} = " + Class1.globaluser;
            CrystalReportViewer1.SelectionFormula = selectFormula;


Posted By: cardpogi
Date Posted: 02 Sep 2008 at 7:04am

i have some time on C#but im kinda new to Crystal Reports... just been with it for weeks now... so if you could please give some extra detail about the in CR selection formulas?




Print Page | Close Window