I am trying to create a report which has conditional formatting.
The primary dataset is a view of objects with several values
eg
object1,0,4,0,1
object2,0,3,1,1
The secondary dataset is the comparison table and just contains the values
eg
0,3,1,1
I'd like to conditionally format the values based on the comparison table but when I create an expression comparing to the second dateset
eg
=iif(Fields!object1.Value <> Fields!comp_object1.Value , "Red", "SkyBlue")
i get
Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope.
Not sure if there is a way to tell the expression to look for comp_object1 in dataset2, even tho it is uniquely named?
Ideas gratefully received !
Yes, I'm pretty sure you can do what you want.
I'll assume that the fields in dataset2 are named comp_object1, comp_object2, etc. I will also assume that dataset2 has one row -- because if it has multiple rows to match dataset1's rows, you should put these columns in the *same* dataset.
In the table based on the first dataset, you can use expressions like this for column #1 -- and I'm pretty sure the scope is case-sensitive, so you may have to play with what I'm suggesting here
Code Snippet
=iif(Fields!object1.Value <> First(Fields!comp_object1.Value, "dataset2") , "Red", "SkyBlue")
To use the expression builder to do this, notice that on the left side there is a "Datasets" item in the list. If you select it, then the middle list has your datasets listed. Click on dataset2 in the middle list and you will see the appropriate items in your right-side list of possible fields...
>L<
|||Thanks, that worked!|||hi,
this is works perfactly........ but i have another issue that i want to display 2 different dataset's fields in a single table. i can put 2nd database's field in table but it can put only with aggregate functions like (first, last...etc.) but i want to put it directly.........bcz if i put it with first function i can't get other records............. can u help me?
|||Basically, except for aggregates that tell it what to display, the processing engine has no way to figure out what record from the other dataset to display in each row <s>.
You can either write a query that combines the data into one dataset, so that you provide the relationship yourself, or you can use a subreport, passing a parameter from the parent dataset that indicates what data to display in the subreport.
Alternatively you can probably do something in code to pull the data from the other dataset (I haven't tried this because I don't really see the point, but it would probably work) .
You can also nest a data region (another table or list or matrix) inside a group row for a table -- and this other data region has its own dataset -- but I gather this isn't what you have in mind.
>L<
|||hi lisa,
Thx a lot for suggestion..............i have tried to put another data region in table with aggregate function but still its not works and gives error........ do u have any otherway?
|||Well, I'm not sure I understand exactly what you tried so I can't explain or help <s>.
Tell us about your two datasets.
Tell us what data region you put in, and where exactly you put it, etc.
Tell us what the error was...
>L<
No comments:
Post a Comment