Conditional expressions in Matrix
I have a datasource with columns Name, Item, Count, Target.
I use in a matrix, so it appears something like this
So, the Name is the row cell, Item is the column cell, and both Count and Target are data cells (CellsSideBySide is True)
My issue is that I want [Count] data cell to be highlighted if it is less than the [Target] data cell, but I just can't figure out the syntax for this.
I tried: Value < [datasource.Target]. But that didn't work (I think [datasource.Target] was always equal to the first row only, but hard to tell).
I tried: Value < (int)Matrix1.Value(1). But that didn't work either (not sure what it was doing, but certainly didn't highlight the data cells that it should have).
So what is the syntax for this?
I use in a matrix, so it appears something like this
------------| Item |
------------| Count | Target |
----------------------------------
Name | [Count] | [Target] |
----------------------------------
So, the Name is the row cell, Item is the column cell, and both Count and Target are data cells (CellsSideBySide is True)
My issue is that I want [Count] data cell to be highlighted if it is less than the [Target] data cell, but I just can't figure out the syntax for this.
I tried: Value < [datasource.Target]. But that didn't work (I think [datasource.Target] was always equal to the first row only, but hard to tell).
I tried: Value < (int)Matrix1.Value(1). But that didn't work either (not sure what it was doing, but certainly didn't highlight the data cells that it should have).
So what is the syntax for this?
Comments
note : in matrix report, cell is printed from left to right (to understand that, uncomment 'MessageBox' from script below).
in your case, cell 'target' is highlighted.
I think the issue is that I'm trying to highlight the count rather than the target, and perhaps the current row/column is not getting updated for all cells at the appropriate time.
As an example, try to change your script so that it is the Items Sold that is highlighted rather than the Revenue (with the same condition). In other words change the cell9.Fill = ... lines to cell6.Fill...
You'll see that it just ends up highlighting cells all over the place.
if you want to highlight first cell when you are at second cell, it wont work because first cell already printed.
so, in your case, switch the column, target | actual