Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use formulas calling some Cross tab rows ? (for formating them)

Status
Not open for further replies.

Labuzz

Programmer
Dec 28, 2004
6
AE

Hello,

I am a very very new user of the "useful" software crystal Reports, and I am also new here.
But I am wondering if you can tell me :
How to use cross tab rows in formula ?
Each time that I try one formula, it is written "Field Unknown" or when there is no error, in is not the good field...

In fact, I have one cross tab on a report where there are for each page the daily worked hours for one employee in each project, like this :

Employee: Dupond Gerard

Project code Number
Worked Date P1 P2 P3 P4 ....Total
28 Nov, Sunday 1 4 4 9
29 Nov, Monday 9 9
30 Nov, Tuesday 6 1 7
01 Dec, Wednesday 2 1 4 7
04 Dec, Saturday 4 5 9
...
Total 3 11 9 18 41

And now I want to HighLight all Saturdays and I want after the cross tab to know how many days are shown there, like this :
There Are 30 Worked Days (for this employee in this period)

Thank you by advance and ...A happy new year !
 
To highlight the row label, right click on it->change border->background->x+2 and enter:

if instr(currentfieldvalue,"Saturday") > 0 then crYellow else crNocolor

Next select a cell in the grid->right click->change border->background->x+2 and enter:

if dayofweek(GridRowColumnValue ("table.date")) = 7 then crYellow else crNocolor

For "table.date", substitute your row field without the curly brackets. Or you can go the crosstab expert->customize style tab, select the row field and check the "alias for formulas" box to see what to enter within the quotes for GridRowColumnValue.

You are placing the crosstab in the group header or footer for a date (week) group within an outer employee group. As far as I know, you cannot use crosstab values in other formulas. What you can do is create a formula:

"There Are "+totext(sum({table.hours},{table.date},"weekly"),0,"")+ " Worked Days for " + {table.name} + " for the week starting "+totext({table.date}-dayofweek({table.date})+1,"dd MMM, dddd")

-LB
 
Hi lbass,

Thanks a lot for your help.
No, thanks to you, I can Hightlight without difficulties the rows that I want.

However for the formula that you tell me to create :
"There Are "+totext(sum({table.hours},{table.date},"weekly"),0,"")+ " Worked Days for " + {table.name} + " for the week starting "+totext({table.date}-dayofweek({table.date})+1,"dd MMM, dddd")
I don't know neither where to create it nor if I have to add something.
Everywhere I tried your formula, it keep prompting to me :
" The summary / running field could not be created. "
Has I told you I am new with CR, so do not let me anything implicit, please tell me everything explicitly.
The only thing I can do in CR is Copy and paste and change the table names ^^

Thank you again !
 
The formula is based on the assumption that you have an employee group as your group #1 and a date group as your group #2, and that the date group is "weekly".

You would create the formula by going to Insert->Field Explorer->Formula->new and entering the formula there. You would substitute your exact field names for {table.hours},{table.date}, and {table.name}. Then the formula would be placed in a group header or footer for the employee group.

I'm guessing the problem is that I am incorrect about your group structure, so please share what the group structure is.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top