Dynamically color to each column in Cross-tab report
Hello All,
I am a newbie in Crystal report,from last few weeks, i am working on cross tab crystal report.i have a requirement to show color dynamically for each column.i am adding an attachment how i want it. i tried dynamic coloring using object field formula but it is showing red color to all data.i want red color data when in 2nd cross tab report data is beyond upper or lower limit in first cross tab table. it will be very helpful if somebody will give me any clue on this.... i read so many articles now it seem like impossible for me..:(
i am using visual studio 2010 and sap crystal report version 13.0.0.99 for visual studio 2010.
Hello Manish,
I have attached a sample report that does this. You will need to remove the .txt extension from the attached file to open it as an .rpt file.
Please right click on one of the value fields of the first cross tab in the report > Format Field > Common > Suppress if Duplicated conditional formula.
The nested formula is as follows;
numbervar array l;
numbervar array u;
numbervar x:=CurrentColumnIndex;
if GridRowColumnValue ('@limit') = 'lower limit' then
(redim preserve l[x];
l[x]:= tonumber(CurrentFieldValue))
else if GridRowColumnValue ('@limit') = 'upper limit' then
(redim preserve u[x];
u[x]:= tonumber(CurrentFieldValue));
false
So it assigns each lower and upper limit value for each client (in the sample it is country) to an array using the cross tabs column index to index the array and it ends in False as we don't actually want it to suppress if duplicated. This nested formula is just used to generate the arrays of upper and lower values.
In the second cross tab if you again right click on one of the value fields > Format Field > Font > Color you will see the following conditional formula;
numbervar array l;
numbervar array u;
numbervar x;
if not(tonumber(CurrentFieldValue) in l[CurrentColumnIndex] to u[CurrentColumnIndex]) then
crred
else
crblack
So this compaes the current field value to range generated by the 2 arrays and assigns a color based on whether or not it is in the range.
Regards,
Graham
Similar Messages
-
How to Add new column in cross tab reports
I am using crystal reports 10
I created cross tab report for monthly sales. I need to add one more column in that report
ex:
Month Customer Part1 Part2 Part3
Jan A 10 12 15
Jan B 20 0 10
Jan C 0 3 5
Feb A 5 10 8
Feb D 55 23 33
In above data Parts are no limit, thatswhy i am taking cross tab report.
I am taking Month and Customer name as Rows,
Part Codes as Colums,
Quantiry as Total fields in cross tab Report.
Here month field is storing as Transaction date in database, I am calculating by month
I am getting upto this.
User needs add one more field is Invoice no
Month Customer Part1 Part2 Part3 Invoice no
Jan A 10 12 15 B1,B2,B3,B4
Jan B 20 0 10 B12,B30
Jan C 0 3 5 B6
Feb A 5 10 8 B35,B40
Feb D 55 23 33 B25,B56
How to add invoice nos by group wise(By customer and By month)
Thank you.
Raja shekar Reddy K.
Edited by: Raja shekhar Reddy on Apr 16, 2009 5:10 PMDear Amogh,
Thanks for u'r Replay.
If i use new crosstab for Invoice no each invoice number can display like seperate columns.
But I need Invoice no in single column with seperate with "," or "/".
Thanks & regards,
Raja Shekar Reddy K. -
How to count number of columns in cross-tab report
I have created a cross-tab report and have managed to get the data out as below:
Jan Feb Mar....(display of months will auto expand) Avg/Mo Total
UserA 4 3 4 11
UserB 6 1 1 8
UserC 5 5 5 15
Total 15 9 10 33
I want to insert a calculated column (Avg/Mo) into the cross-tab report based on the formula: Total/Number of Months. I used this calculation formula for Avg.Mo column:
(GridValueAt(CurrentRowIndex, CurrentColumnIndex+1, CurrentSummaryIndex)/GetNumColumns)
However, I get the wrong average since GetNumColumns count the total number of columns including the column of Avg/Mo and Total.
How do i get the number of columns, excluding the Avg/Mo calculated column and Total column?
PS: I can't use hardcode since the number of months/columns will auto expand the months progress...
Edited by: jutamind on May 26, 2010 9:27 AMok managed to solve this by slightly changing the formula:
GridValueAt(CurrentRowIndex, CurrentColumnIndex+1, CurrentSummaryIndex)/(GetNumColumns-2) -
Limiting Columns in Cross Tab reports
Plz tell me how to limit columns in Cross Tab.I have many columns which go on and even are not visible for Scroll and neither in another page
Plz help.Check if http://winrichman.blogspot.com/2009/05/cross-tab-by-limiting-number-of-colums.html is helpful
-
More than one summary column in cross tab reports
Hi,
I have a cross tab report. The summary column is SUM. I want to add another summary column next to SUM which will be AVG(Average) column.
Any ideas?
Please see the attached image.
Thanks,hi Anurag,
my fault...i should have looked closer at your data.
here's the easy way of showing two sets of summaries at the end of a crosstab, without having duplicate columns.
1) copy your existing cross-tab and paste it to the right of your current cross-tab.
2) now go to the cross-tab expert of the new cross-tab and remove the fields from the Column dialogue
3) change the summary to an Average
4) exit the cross-tab expert and go to the Section Expert for the section where both cross-tabs are...ensure that you check Relative Positions
preview the report. now you'll have to move the 2nd cross-tab a bit so that it aligns properly with the first one.
as a sample, see the attached report. extract the contents and change the .txt extension to .rpt.
-jamie -
Suppressing a prior Year Month Column on Cross Tab Report
I have two cross tab report in the footer that compares orders booked against what was shipped by month. I need to suppress the columns (Month) for the prior year but keep the Totals.
I have a pdf of the reportTry to add a formula as a column in the crosstab instead of a field. Create a formula like this
if year()=year(currentdate)-1 then
year()
else
month()
This works only for two years of data, means you need to have the record selection formula like this
year()>=year(currentdate)-1 and year()=year(currentdate)
Regards,
Raghavendra -
Dynamic parameter passing through hyperlink in Cross tab report
Hi,
I have a requirement in which I have to create a hyper link to parent report (measures) the format of parent report looks like
1. Left side Dimensions
2. Report header contains again with dimension
3. Body of the cross tab contains some details , dimensions and measures.
Here My requirement is to create a hyperlink on mesures (body) so that the corresponding left side dimension and dimension value in the header should go as input parameters to child report dynamically. The child report has two prompts . i.e both are dimensions and based on the input data from parent the child report displays the granular data.
Can any one help me how to create a hyperlink to pass dynamic values on columns and not hardcoding values.
Any help is highly aprreciated.
Thanks in Advance,
Suresh Aluri.Hi,
I'm trying to do something very similar. I have a crosstab report with dimensions on the left (month/year) and on the header (ticket category). However, I'm having trouble passing the measure in the intersecting cell to a child report. This measure is created from the fact table and equates to a count of the tickets. However, it's not exactly 'select count(ticketID) from tablename' and I think that is part of my problem.
In the child report (tabular), I'm passing the same month/year and category dimension values. However, I'm not sure how to pass the measures over. What I want is basically a detailed list of the ticket IDs in a tabular form.
So for example, in the parent report, if there are 12 tickets listed under Jan 09 & category A; then I want the child report to list those 12 tickets.
My problem is that I'm getting more than 16 instead of 12 records.
Thanks in advance,
Carter -
Hide Column in Cross Tab Report
Hi guys,
I have an issue with the Cross Tab in CR2008.
I'm using 2 columns to calculate an other column, but these 2 columns should not be displayed in the report.
I tried to suppress the column but it still shows a white space.
I tried to change the column width, but it cant get it smaller then 0,113.
Can anyone tell me how to set the column width smaller using a formula or how to suppress the whole column.
Thanks in advance.
WilliamHi William,
Instead of using all 3 columns in the crosstab, just drop your main columnn on.
In the Design window, not the Crosstab Experrt, right-click the summary field and select Format Field.
In the Common Tab, open the formula for Display String.
Now you can take the value of your summary using the CurrentFieldValue and make your total. You may need to summarize the supporting numbers to calculate properly but it should work here properly.
I've used this for things like running totals and repeating values between rows.
NOTE: This formula only returns a string so make sure you format your final value as a string.
Good luck,
Brian -
How to insert page number on each page for Cross-Tab report?
Hi,
I have created a Cross-Tab in the section Report Header via Crystal Reports 11.
Now, I want to created more Cross-Tabs, and each page has one Cross-Tab.
So, I insert Report Headers to contain Cross-Tabs. But, the report only shows the page number at the last page.
How to insert page number on each page?
Thanks in advance.Hi,
Well, the easiest solution is to place the Cross-tab in the Report Footer, Of course, ONLY if the report contains this single object which I'm assuming is not the case.
If you do not wish to place the cros-tab in the Report Footer, here's what you need to do:
1) Create a formula;
whilereadingrecords;
2) Create a group on this formula. If the report already contains groups, move this formula to the top of the grouping list. It won't affect the other groups or records in any way.
3) Move the Cross-tab from the Report Header to the Group Header1 and suppress Group Footer1
4) Add the Page Number field to the Page Footer
Let me know how this goes!
-Abhilash -
Unable to create cross tab report with multiple level dynamic columns
Hi Gurus,
We are trying to develope group above cross tab report with BI Publisher.
i am unable to achieve multiple level columns dynamically.Using cross tab wizard i can achieve single level measure column ,but not the second level column.
Output should look like this:
Country1
Region1 Region2 Region3 --(level1 column)
d1 d2 d3 d1 d2 d3 d1 d2 d3 -- (level2 column)
Row1 10 20 30 70 80 90 40 70 90 --data
Row2 21 24 54 65 23 64 64 76 87
Here regions and d1 d2 d3 may vary based on xml data.Also we have page break on country.
Thanks,
MaheshHi kavipriya,
Any update on this.I have set the rtf and xml to ur gmail id.
Thanks,
mahesh -
How to add an image or static text in the header of EACH page of a cross-Tab report
Post Author: rtutus
CA Forum: General
Hi, I use Crustal 11.0.
I have a cross Tab. I display the items on the left column and the months horizontally, the items are grouped by category field. The values are the sum of quantities are displayed for each month. Like this:
Items Jan Feb March .....................Total
Category 1
Item11 val11 Val12 Val13 Total values
Item12 val21 Val22 Val23 Total values
Item13 val31 Val32 Val33 Total values
Category 2
Item21 val11 Val12 Val13 Total values
Item22 val21 Val22 Val23 Total values
Item23 val31 Val32 Val33 Total values
Category 3
Item31 val11 Val12 Val13 Total values
Item32 val21 Val22 Val23 Total values
Item33 val31 Val32 Val33 Total values
The problem, I want to add a page header for each page of the report.
When Crystal reports first displays my cross-tab in the designer, CR displays the cross tab in the Report header section. I d like to add text or image for each page and not only at the begining of my Cross-Tab.
If I just add an image or text at the top of the report designer, which is my report header, I get the image or text only on the begining of the 1st page of my report but never in the other following pages.
If I try to work around the problem and move the cross Tab to a group section instead, and then put the Image in the group header, I get what I want, but the problem is that:
The columns header: Jan, February....December are displayed for each group of my report and not only in the beginning of the report. I get something like this:
Items Jan Feb March .....................Total
Category 1
Item11 val11 Val12 Val13 Total values
Item12 val21 Val22 Val23 Total values
Item13 val31 Val32 Val33 Total values
Items Jan Feb March .....................Total
Category 2
Item21 val11 Val12 Val13 Total values
Item22 val21 Val22 Val23 Total values
Item23 val31 Val32 Val33 Total values
Items Jan Feb March .....................Total
Category 3
Item31 val11 Val12 Val13 Total values
Item32 val21 Val22 Val23 Total values
Item33 val31 Val32 Val33 Total values
You see the months get duplicated. Any way, my real need is to add an image or text in the header of EACH page of a cross-Tab report.
Thanks a lot for your help.Hi Divya,
you could do for example in the wdDoInit() of the view
wdContext.currentContextElement().setPicture("picture.gif");
Now you assign this context variable to the Tab using the Tab_header's imageSource-Property. When you click on its value column, you see a button with three dots on it. If you click on this button, you will get all context nodes and attributes for this View. Usable variables are clearly marked, you now choose the one named Picture or what ever name you prefer to use. But it must correspond to the one set in the wdDoInit.
I think setting a picture (not necessarily for the tab-page) is done in one of the excellent tutorials. If you are a newcomer I strongly recommend doing some of the tutorials. I have learned tremendously from them.
Hope this helped
Harald -
Unable to get cells for the columns which have no data in cross-tab report
Hi friends,
I am developing a cross-tab report.
Let's take an example to explain the problem.
Here is the XML file i am using
<?xml version="1.0" ?>
- <!-- Generated by Oracle Reports version 6.0.8.11.3
-->
- <MODULE1>
- <LIST_G_SCHEMECODE>
- <G_SCHEMECODE>
<SCHEMECODE>171091</SCHEMECODE>
<AMOUNT>0</AMOUNT>
<ASSET_TYPE>Govt Guarantee</ASSET_TYPE>
<MARGIN>0</MARGIN>
<AMOUNT_SECURED>0</AMOUNT_SECURED>
<VALUE_OF_SECURITY>0</VALUE_OF_SECURITY>
</G_SCHEMECODE>
- <G_SCHEMECODE>
<SCHEMECODE>171091</SCHEMECODE>
<AMOUNT>0</AMOUNT>
<ASSET_TYPE>Loans To Govt</ASSET_TYPE>
<MARGIN>0</MARGIN>
<AMOUNT_SECURED>0</AMOUNT_SECURED>
<VALUE_OF_SECURITY>0</VALUE_OF_SECURITY>
</G_SCHEMECODE>
- <G_SCHEMECODE>
<SCHEMECODE>171093</SCHEMECODE>
<AMOUNT>0</AMOUNT>
<ASSET_TYPE>Govt Guarantee</ASSET_TYPE>
<MARGIN>120</MARGIN>
<AMOUNT_SECURED>0</AMOUNT_SECURED>
<VALUE_OF_SECURITY>0</VALUE_OF_SECURITY>
</G_SCHEMECODE>
- <G_SCHEMECODE>
<SCHEMECODE>171093</SCHEMECODE>
<AMOUNT>0</AMOUNT>
<ASSET_TYPE>Loans To Govt</ASSET_TYPE>
<MARGIN>0</MARGIN>
<AMOUNT_SECURED>0</AMOUNT_SECURED>
<VALUE_OF_SECURITY>0</VALUE_OF_SECURITY>
</G_SCHEMECODE>
- <G_SCHEMECODE>
<SCHEMECODE>*171095*</SCHEMECODE>
<AMOUNT>0</AMOUNT>
<ASSET_TYPE>Govt Guarantee</ASSET_TYPE>
<MARGIN>100</MARGIN>
<AMOUNT_SECURED>0</AMOUNT_SECURED>
<VALUE_OF_SECURITY>0</VALUE_OF_SECURITY>
</G_SCHEMECODE>
</LIST_G_SCHEMECODE>
</MODULE1>Now I want SCHEMECODE in rows and ASSET_TYPE in columns.
And the each ASSET_TYPE column is to be divided into 2 sub-columns (MARGIN,AMOUNT_SECURED).
I am able to achevie this.
The problem is that ,for the schemecode 171095, since there is no data for ASSET_TYPE "Loans To Govt",no cells are generated for this SCHEMECODE and ASSET TYPE.
But the requirement is to generate blank cells.
If needed i will send the template at xml files also.try this, there must be simpler one i guess...
1. take a form field, and make its type as number. Paste the below one <?xdoxslt:set_variable($_XDOCTX,'v1',2)?>
2. now take a table with as below,
A l B |
C l D1 l D2 l E1 l E2 l
observe that i. A, C are in one column
ii. cell B is on top of D1, D2
iii. we have no cell on top of E1 and E2 cells
iv. 'l' represents the wall of the cell :)
A: <?horizontal-break-table:1?> SCHEMECODE
B: <?for-each-group@column:G_SCHEMECODE;ASSET_TYPE?> <?ASSET_TYPE?> <?end for-each?>
C: <?for-each-group:G_SCHEMECODE;SCHEMECODE?> <?xdoxslt:set_variable($_XDOCTX,'v1',2)?> <?SCHEMECODE?>
D1: <?for-each-group@cell:current-group();ASSET_TYPE?> <?MARGIN?> <?xdoxslt:set_variable($_XDOCTX,'v1',xdoxslt:get_variable($_XDOCTX,'v1')-1)?>
D2: <?AMOUNT_SECURED?> <?end for-each?> <?end for-each?>
E1: <?for-each@column:xdoxslt:foreach_number($_XDOCTX,1,xdoxslt:get_variable($_XDOCTX,'v1'),1)?>
E2: <?END FOR-EACH?>
3. If you are confused gimme your email id, i will pass the template. But you should add credits to me.. :) -
Sub-Summarizing columns in Cross Tab
Post Author: valkyriexp
CA Forum: General
Hi,
I'm fairly new in using CR, I wonder if anyone could help me.
I have a cross tab report of projects in rows, activities in columns and hours in table, i need to insert few new columns that have the sum of hours of the selected activities. Is that possible without breaking the report into sub-reports?
some thing like
Act1 Act2 Sum1&2 Act3 Act4 Act5 Sum3&4&5 .....
Proj1 1 1 2 4 2 1 7
Proj2 2 1 3 1 0 0 1
thanks for the helpPost Author: valkyriexp
CA Forum: General
After spending half a day i was able add a new field to each column to does the job, small piece of macro is doing the summation, now i have the problem to set the width of empty fields to zero, can anyone help?
WhileReadingRecords;global NumberVar sumnum;global StringVar OutStr;
if {jobs.acts}="Act1" or {jobs.acts}="Act3" then sumnum:={jobs.hour}else if {jobs.acts}="Act2" or {jobs.acts}="Act4" or {jobs.acts}="Act5" or ... then sumnum:=sumnum+{jobs.hour}else sumnum:=0;
if {jobs.acts}="Act2" or {jobs.acts}="Act5" then OutStr:=cstr(sumnum);else OutStr:="";
the result would be like the following table, now i need to set the width of empty fields to zero:
Act1 Act2 Act3 Act4 Act5 .....
Proj1 1 1 2 4 2 1 7
Proj2 2 1 3 1 0 0 1 -
How to display recordnumber for each row in cross tab?
<p>Hi.. </p><p>I am using Crystal Report XI,with the database Microsoft SQL Server. I have 2 questions regarding Cross Tab.</p><p>1. How to limiting record per row and per column in Cross Tab? For example,at one page the report printing 20 records per row and 7 records per columns.</p><p>2. I would like to display recordnumber for each row that printing in Cross tab. How crystal reports can handle this?</p><p>Can anyone can help me out on this? </p><p>Please kindly advise.</p><p>AN </p><p> </p><p> </p>
<p>Dear Kathryn,</p><p> </p><p>I did used DisplayString as suggested by you. The result work fine until I add more data to this cross tab. I used this formula : </p><p> global numbervar pager;</p><p>recordnumber();</p><p>pager := pager + 1; </p><p> if pager > 0 then totext(pager - 1,0) </p><p> </p><p>The result come out in decending order for each row. </p><p>SN Name </p><p>5 abc<br /></p><p> 4 def</p><p>3 fig<br /></p><p>2 klm<br /></p><p>1 opq</p><p> Is that anything wrong with my formula?<br /> </p><p>Please kindly advise.</p><p>-AN- </p><p> </p><p> </p>
-
Sorting by date in columns cross tab report.
Hi all,
I am working on a cross tab report in BI Publisher in which columns are generated dynamically in a pivot table depicting months as Jan 09 , Feb 09.... but data type is char.When displayed in pdf, columns are generated sorted alphabetically.
How can I have them sorted by date in final pdf?
or
How can I stop the columns being sorted in pivot table at template level?
Thanks.
Edited by: user9061488 on Jul 21, 2010 1:13 AMYou need to get a extra column in the query just for sorting purpose, which will have month number in it or YYYYMMDD. format, so that , it can be used in only for sorting.
with JAN 09, FEB 09 , we can do it, but it will be little complex
Maybe you are looking for
-
How do I merge two iCloud accounts into one? One account is on my mac and ipad, the other on my iphone.
-
Designer hangs during universe creation against SAP BW
Hi, We are trying to create OLAP universe against SAP BW 3.5 and we are running into issue wherein the designer just hangs and is not able to create the classes and objects, in most cases we have waited for about 30-35 mins and still it doesn't come
-
Preferences item in app menu is missing
Hi, I have problems setting up preferences in two apps (one dowenloaded in App Store (planbook), one on developers page (logisim)). There is no preferences menu item in the menu. Both developers explain how to find this preferences menu item same: Se
-
Do you want to save changes you have made? Message
I have a form with 3 data blocks. Data block 1- master_blk data block 2- detail_blk1 (detail of the master block) data block 3- detail_blk2 (detail of DETAIL_BLK1) So its a 3 level parent child relationship. MASTER_BLK parent to DETAIL_BLK1 and DETAI
-
Flash suddenly won't Codesign?
Here's my setup: - Using Windows 7 with Flash CS5 for Development - Using Snow Leopard for Certificates / Keychain Access and Application Loader 1.3 On November 3rd I developed my first App. Created the certificates just fine. Published to the Apple