cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with crosstab again

Former Member
0 Kudos

I have a report based on a table:

DayInfo(Date date, name varchar, NeedWork boolean, CanWork boolean)

The report is grouped by months (a date grouping).

X-coordinate is NeedWork.Date

Y-coordinate is NeedWork.Name

Cells have DayInfo.NeedWork

I want to make a cell color depended on CanWork flag.

I do it this way:

<code>if {DayInfo.CanWork} then

(

Color(255,0,0)

)

else

(

Color(0,255,0)

)

</code>

The problem is: CanWork has the same value always, though the table has different values.

Even if I use not a color, but value output instead, the data appeared on report is the same:

02.02.3909 03.02.3909 04.02.3909 05.02.3909

Ivan 02.02.3909 02.02.3909 02.02.3909 02.02.3909

I want to see different dates:

02.02.3909 03.02.3909 04.02.3909 05.02.3909

Ivan 02.02.3909 03.02.3909 04.02.3909 05.02.3909

Question: Why it doesn't work and what to do?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks, it's what I want to know

Former Member
0 Kudos

For some reason, crosstabs to not keep the data record fields available in the body cells (at least as far as I have noticed). I have run into similar situations, and have approached it this way:

Create a formula field, call it {@cellValue} (basic syntax):


formula = iif({NeedWork}, "Y","N") + iif({CanWork}, "Y","N")

Make the table body cells MAX({@cellValue}).

In the Display String format property of the body cell, use:


formula = mid(CurrentFieldValue, 1, 1)  '  Pull off first character (NeedWork)

And in either the Font Color or Background Color format property, use:


if mid(CurrentFieldValue, 2, 1) = "Y" then  ' If CanWork...
  formula = Color(255,0,0)
else
  formula = Color(0, 255, 0)
end if

HTH,

Carl

Former Member
0 Kudos

Link for downloading my report http://sql.ru/forum/actualfile.aspx?id=7135107