Dynamic color in report column

Hi, All
I design a report and display the column as Text field,
in the column "Element Attributes", I put in
style= "width:400px;height:400px;background-color:green.;font-size:100px;font-weight:bold;text-align:center",+
the column will be displayed in green color.
I tried to make the colour more flexible but put in the color text into a text box, eg:P51_COLOR
and I modified the "Element Attributes" to
style= "width:400px;height:400px;background-color:&P51_COLOR.;font-size:100px;font-weight:bold;text-align:center"
but the color wasn't display as what I expected.
Anyone have solution for this?
Thanks
Edited by: pj**** on 26-Apr-2012 20:25

Interactive Report or Classic?
I presume it is "multi-row" and not single row as you mention column.
Regards,

Similar Messages

  • 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

  • Dynamic Selection of Report Column Format

    Is it possible to dynamically set the number format on a report column? I thought it would be as easy as setting the 'Number/Date Format' to a session state variable such as &NUMBER_FORMAT. However, when I tried this the column returned the following value ##########.
    Any ideas?
    Thanks,
    David

    OK, this is a favorite hack of mine combined with Sergio's suggestion. Essentially, we select the column twice, display it with one column using Sergio's idea and sort it on another hidden and unformatted copy of the column (hope I didn't lose you yet):
    1) Add another column of the same source to the query and give it an alias:select ename,to_car(sal,'&NUMBER_FORMAT.') sal,sal sal_sort
      from emp2) Edit the report > report attributes > sal_sort column attributes. In the HTML Expression field, type #SAL#.
    3) On the report attributes page, unclick the "Show" column for sal.
    Now you are displaying the SAL column in the SAL_SORT column allowing the reporting engine to properly sort the column based on the unformatted SAL_SORT. I use this technique a lot for quarters. I'll show Q105, but it's sorting on an actual date behind the scenes.
    Happy hacking!
    Tyler

  • Dynamic URL with report column not showing

    I created a URL based on a report column in select report region, however instead of seeing the URL link I see the whole text , what am i doing wrong ?
    Fee Detail
    select col1, col2,
    CASE
    WHEN DPF_CLIENT_FEE_TYPE ='THPSCL' THEN
    'Fee Detail'
    ELSE NULL END AS col3
    from table
    Thanks for your help
    Edited by: user5397822 on Dec 20, 2011 1:00 PM

    Check that the "Strip HTML" opion is not set to Yes on the Report Attributes page (Layout section).

  • Dynamically change the report column name.

    Hi All,
    I have a report where i am showing data for greater than current week and year and the code of same is below
    SELECT
        item_number,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+1 THEN
                    quantity
            END
        ) plus_1,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+2 THEN
                    quantity
            END
        ) plus_2,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+3 THEN
                    quantity
            END
        ) plus_3,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+4 THEN
                    quantity
            END
        ) plus_4,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+5 THEN
                    quantity
            END
        ) plus_5,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+6 THEN
                    quantity
            END
        ) plus_6,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+7 THEN
                    quantity
            END
        ) plus_7,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+8 THEN
                    quantity
            END
        ) plus_8,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+9 THEN
                    quantity
            END
        ) plus_9,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+10 THEN
                    quantity
            END
        ) plus_10,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+11 THEN
                    quantity
            END
        ) plus_11,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+12 THEN
                    quantity
            END
        ) plus_12,
        SUM
        (   CASE
                WHEN year_week_num = to_number(to_char(sysdate,'IW'))+13 THEN
                    quantity
            END
        ) plus_13     
    FROM
        (   select
                re.item_number,
                row_gen.year_week_num,
                SUM(NVL(re.quantity,0)) OVER(PARTITION BY re.item_number ORDER BY row_gen.year_week_num) quantity,
                ROW_NUMBER() OVER(PARTITION BY re.item_number, row_gen.year_week_num ORDER BY NULL) rn
            from
                (   SELECT
                        to_number(to_char(sysdate,'IW')) + ROWNUM year_week_num
                    FROM
                        DUAL
                    CONNECT BY LEVEL <= 13
                ) row_gen LEFT OUTER JOIN
                        (   SELECT
                                le.item_number,
                                le.quantity,
                                to_number(to_char(sysdate,'IW'))+1 year_week_num
                            FROM
                                BACKLOG_WEEK_WH_AFTR_ATP le
                            UNION ALL
                            SELECT
                                re.item_number,
                                -re.quantity,
                                to_number(substr(re.year_week,-2,2)) year_week_num
                            FROM
                                BACKLOG_ATP_GT_CW re
                         ) re
                    PARTITION BY (re.item_number)
                    ON ( row_gen.year_week_num = re.year_week_num)
    WHERE
        rn = 1
    GROUP BY
        item_numberI have a item in the report page from which i am displaying which week this year holds and the code of same is below
    In the item source, i have selected source type as sql query return single value. and the current week is returning as "2011-WK30"
    select to_char(sysdate,'YYYY"-WK"IW') from dual;Please suggest how i can change the display of column dynamically. I want PLUS_1 to show as 2011-WK31, PLUS_2 to show as 2011-WK32 and so on for this week. When next week will come then the plus_1 should show as 2011-WK32, plus_2 to show as 2011-WK33.
    Any help how to do this?
    Thanks in advance
    Regards

    Hi,
    Go to the Report Attributes, in the Column Attributes section:
    1) Use Headings Type as PL/SQL.
    2) In the text area Function returning colon delimited headings write a PL/SQL anonymous block returning colon delimited headings.
    Hope it helps!
    Regards,
    Kiran

  • Dynamic alignment of report column and page item value

    Hi friends,
    I have an interactive report which contains the columns like
    <li>empno
    <li>Name
    In the above i have "empno" with a column alignment of left and a "Name" with a column alignment of left.
    Whether it is possible to override the data alignment that we set in the report according to the value of the application item like
    If my application item value is US, then i need the column alignment of both the column"empno" and "Name" to be left and if my application item value is AR, then i need the column alignment of both the column "empno" and "Name" to be right. Whether is it possible to achieve the dynamic alignment to the report data of both the columns "empno" and "Name" according to the application page item value.
    And also in the case of page item i have a page item with a name P1_NAME in which it has a Element Horizontal/Vertical alignment to left.
    I need that element alignment of the page item to behave dynamically according to the application page item, like if the application page item is US then the element alignment of the page item has to be left and if the application page item is AR then the element alignment of the page item has to be right.
    Whether is it possible to achieve my above two scenario's friends. Kindly help me with this.
    Thanks in advance.
    Brgds,
    Mini

    Kees,
    Your approach is excellent and brilliant:-)
    I tried with your steps and i can achieve those alignment in both ways like you said(either on page load/through DA).
    But im going with the DA way. I have certain query regarding this kees.
    <li>Suppose if the report, is classic whether i can go with the same approach that i have achieved alignment with the IR report.
    <li>Currently through the DA way, i used the page item in the condition. Is it possible to use the application item instead of page item in DA. Because im going to use the application item FSP_LANGUAGE_PREFERENCE for getting the code either 'AR' or 'US'.
    <li>Finally i need this kind of restriction for the page item also, consider like i have a page item P1_X with an Element Vertical/Horizontal alignment as left. Now i need to change that alignment to right according to the application page item value, hence i can give application item condition for the page item like below
    PL-SQL EXPRESSION: :FSP_LANGUAGE_PREFERENCE = 'AR'
    i need the element alignment of the page item to behave dynamically suppose if the application item value is AR then the element alignment of that page item has to be right if the application item value is US then the element alignment of that page item has to be left, irrespective of the page item Element Vertical/Horizontal alignment that was set to it.
    Thanks for your kind help
    Brgds,
    Mini

  • How to show the columns dynamically in OBIEE report based on the selection?

    Hi,
    I have a requirement where the columns should be dynamically shown in report based on what we select in propmt page.
    I'm creating a report in OBIEE where i want to give an option to the end user to select the columns whichever he wants to see in the report.
    For example I have the following columns in the report already:
    Customer Name,
    Customer Number,
    Bank Account,
    Address
    I want to give an option to the user to select 'Customer Mail ID' dynamically and see the column to be displyed in the report along with the existing columns.
    Through 'Column Selector' user can select a single column at a time, but if he want to select more than one column, how can we do this ?
    Please help me out in resolving this issue.
    Thanks,
    Chaithanya.

    Hi Chaithanya,
    there's not a straight solution for this. You can create different analysis containing different number of columns and then directing the user to this analysis using Action Links or you can also use View Selector to switch from one view (analysis) to the other. But it's not going to be very flexible nor dynamic.
    J.

  • Can we change the background color of a Standard report "column"?

    4.2.1
    Theme 24 - Cloudy
    Hi There,
    I searched this forum and online but did not get a straight forward way to change the color of a standard classic Apex report column. I want the whole columns background color to be blue. I tried some of the suggestions for using span etc, but they did not work.
    Was wondering if anyone has a solution for this? would be very helpful!
    Thanks,
    Ryan

    Use a custom named column report template with <tt>&lt;colgroup&gt;/&lt;col&gt;</tt> and CSS as in these threads.
    Could also be done with JavaScript, but if the entire column is to be coloured (rather than individual cells based on some condition), the template approach will be simpler and have better performance

  • How to create  some columns dynamically in the report designer depending upon the input selection

    Post Author: ekta
    CA Forum: Crystal Reports
    how  to create  some columns dynamically in the report designer depending upon the input selection 
    how  export  this dynamic  report in (pdf , xls,doc and rtf format)
    report format is as below:
    Element Codes
    1
    16
    14
    11
    19
    10
    2
    3
    Employee nos.
    Employee Name
    Normal
    RDO
    WC
    Breveavement
    LWOP
    Sick
    Carers leave
    AL
    O/T 1.5
    O/T 2.0
    Total Hours
    000004
    PHAN , Hanh Huynh
    68.40
    7.60
    76.00
    000010
    I , Jungue
    68.40
    7.60
    2.00
    5.00
    76.00
    000022
    GARFINKEL , Hersch
    66.30
    7.60
    2.10
    76.00
    In the above report first column and the last columns are fixed and the other columns are dynamic depending upon the input selection:
    if input selection is Normal and RDO then only 2 columns w'd be created and the other 2 fixed columns.
    Can anybody help me how do I design such report....
    Thanks

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • Color to the column details in report

    Is it possible to apply color to the column details of a particular column in Interactive report ?
    Yogesh
    Edited by: yogeshyl on Jan 27, 2010 10:32 AM

    I assume you mean a different table header colour.
    There is a class that it uses:
    .apexir_WORKSHEET_DATA th {
    -moz-background-clip:border;
    -moz-background-inline-policy:continuous;
    -moz-background-origin:padding;
    background:#4E4E4E url(../ws/report_bg.gif) repeat-x scroll 0 0;
    border-bottom:1px solid #AAAAAA;
    border-top:1px solid #CCCCCC;
    color:#FFFFFF;
    font-size:8pt;
    font-weight:bold;
    letter-spacing:1px;
    white-space:nowrap;
    }So you make changes to this to suit what you want - i.e. you could add that style with your own implementation to overwrite the built in design, in a header region of your page.
    Ta,
    Trent

  • Displaying different colors for cells/columns in Interactive Report

    Hi,
    I have a requirement to display just the 'cells' in the Interactive Report columns with different colors.
    There are 3 columns in the Interactive report.
    The color coding for all the 3 different columns should be such that:
    <40% - red color
    40-70-orange
    greater than 70%-green
    I tried the highlight option in the report and saved the report as default, but still the color condition ended up getting displayed to the end user. I dont want this.
    Can someone suggest a better way to handle this requirement?

    Perhaps explore similar solutions described here
    Background Colour of Report Cell Issues.
    Scott

  • How to generate report with dynamic variable number of columns?

    How to generate report with dynamic variable number of columns?
    I need to generate a report with varying column names (state names) as follows:
    SELECT AK, AL, AR,... FROM States ;
    I get these column names from the result of another query.
    In order to clarify my question, Please consider following table:
    CREATE TABLE TIME_PERIODS (
    PERIOD     VARCHAR2 (50) PRIMARY KEY
    CREATE TABLE STATE_INCOME (
         NAME     VARCHAR2 (2),
         PERIOD     VARCHAR2 (50)     REFERENCES TIME_PERIODS (PERIOD) ,
         INCOME     NUMBER (12, 2)
    I like to generate a report as follows:
    AK CA DE FL ...
    PERIOD1 1222.23 2423.20 232.33 345.21
    PERIOD2
    PERIOD3
    Total 433242.23 56744.34 8872.21 2324.23 ...
    The TIME_PERIODS.Period and State.Name could change dynamically.
    So I can't specify the state name in Select query like
    SELECT AK, AL, AR,... FROM
    What is the best way to generate this report?

    SQL> -- test tables and test data:
    SQL> CREATE TABLE states
      2    (state VARCHAR2 (2))
      3  /
    Table created.
    SQL> INSERT INTO states
      2  VALUES ('AK')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AL')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AR')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('CA')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('DE')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('FL')
      3  /
    1 row created.
    SQL> CREATE TABLE TIME_PERIODS
      2    (PERIOD VARCHAR2 (50) PRIMARY KEY)
      3  /
    Table created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD1')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD2')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD3')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD4')
      3  /
    1 row created.
    SQL> CREATE TABLE STATE_INCOME
      2    (NAME   VARCHAR2 (2),
      3       PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
      4       INCOME NUMBER (12, 2))
      5  /
    Table created.
    SQL> INSERT INTO state_income
      2  VALUES ('AK', 'PERIOD1', 1222.23)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('CA', 'PERIOD1', 2423.20)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('DE', 'PERIOD1', 232.33)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('FL', 'PERIOD1', 345.21)
      3  /
    1 row created.
    SQL> -- the basic query:
    SQL> SELECT   SUBSTR (time_periods.period, 1, 10) period,
      2             SUM (DECODE (name, 'AK', income)) "AK",
      3             SUM (DECODE (name, 'CA', income)) "CA",
      4             SUM (DECODE (name, 'DE', income)) "DE",
      5             SUM (DECODE (name, 'FL', income)) "FL"
      6  FROM     state_income, time_periods
      7  WHERE    time_periods.period = state_income.period (+)
      8  AND      time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
      9  GROUP BY ROLLUP (time_periods.period)
    10  /
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> -- package that dynamically executes the query
    SQL> -- given variable numbers and values
    SQL> -- of states and periods:
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3    TYPE cursor_type IS REF CURSOR;
      4    PROCEDURE procedure_name
      5        (p_periods   IN     VARCHAR2,
      6         p_states    IN     VARCHAR2,
      7         cursor_name IN OUT cursor_type);
      8  END package_name;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3    PROCEDURE procedure_name
      4        (p_periods   IN     VARCHAR2,
      5         p_states    IN     VARCHAR2,
      6         cursor_name IN OUT cursor_type)
      7    IS
      8        v_periods          VARCHAR2 (1000);
      9        v_sql               VARCHAR2 (4000);
    10        v_states          VARCHAR2 (1000) := p_states;
    11    BEGIN
    12        v_periods := REPLACE (p_periods, ',', ''',''');
    13        v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
    14        WHILE LENGTH (v_states) > 1
    15        LOOP
    16          v_sql := v_sql
    17          || ',SUM(DECODE(name,'''
    18          || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
    19          || '"';
    20          v_states := LTRIM (SUBSTR (v_states, 3), ',');
    21        END LOOP;
    22        v_sql := v_sql
    23        || 'FROM     state_income, time_periods
    24            WHERE    time_periods.period = state_income.period (+)
    25            AND      time_periods.period IN (''' || v_periods || ''')
    26            GROUP BY ROLLUP (time_periods.period)';
    27        OPEN cursor_name FOR v_sql;
    28    END procedure_name;
    29  END package_name;
    30  /
    Package body created.
    SQL> -- sample executions from SQL:
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR                                                        
    PERIOD1       1222.23                                                                              
    PERIOD2                                                                                            
                  1222.23                                                                              
    SQL> -- sample execution from PL/SQL block
    SQL> -- using parameters derived from processing
    SQL> -- cursors containing results of other queries:
    SQL> DECLARE
      2    CURSOR c_period
      3    IS
      4    SELECT period
      5    FROM   time_periods;
      6    v_periods   VARCHAR2 (1000);
      7    v_delimiter VARCHAR2 (1) := NULL;
      8    CURSOR c_states
      9    IS
    10    SELECT state
    11    FROM   states;
    12    v_states    VARCHAR2 (1000);
    13  BEGIN
    14    FOR r_period IN c_period
    15    LOOP
    16        v_periods := v_periods || v_delimiter || r_period.period;
    17        v_delimiter := ',';
    18    END LOOP;
    19    v_delimiter := NULL;
    20    FOR r_states IN c_states
    21    LOOP
    22        v_states := v_states || v_delimiter || r_states.state;
    23        v_delimiter := ',';
    24    END LOOP;
    25    package_name.procedure_name (v_periods, v_states, :g_ref);
    26  END;
    27  /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR         CA         DE         FL                       
    PERIOD1       1222.23                           2423.2     232.33     345.21                       
    PERIOD2                                                                                            
    PERIOD3                                                                                            
    PERIOD4                                                                                            
                  1222.23                           2423.2     232.33     345.21                       

  • How to spilt columns dynamically in the report based on Date Parameters

    Hi All,
    We have an XML Publisher report in which the parameters are Fom date and To date.
    User wants the data in the report to be split dynamically based on the months in the From date and To date interval.
    Eg. if the From date is 01-JAN-2013 and To date is '31-MAR-2013' then the report should show 3 columns JAN,FEB and MAR and the corresponding data.
    if the From date is 01-JAN-2013 and To date is '31-MAY-2013' then the report should show 5 columns JAN,FEB,MAR,APR and MAY and the corresponding data.
    Can anyone please advise, how can we spilt the months and data dynamically in the report.
    Regards,
    Shruti

    well you wanted the columns to be added dynamically.  the easiest way would be to use a Pivot since the columns are based on the values in the data.  and if the values of that column are Month Name/Abbreviation for that date then you will get month columns.
    Have you worked with Pivots before?

  • Adding the columns dynamically in crystal report

    Hi,
      I am developing a application using asp.net and crystal report. In a report the column is created dynamically( ie, the report gets input from a sp which returns N no. of columns). Since i dont know the column name and no. of columns at design time i am not able to create the report. If any of you have any idea on adding the columns dynamically please send me the code or the link.
    Thanks
    Sankar

    Hello Sankar,
    please see CS code for VS 2005 below to add a database field to a report using inproc RAS.
    This sampels retrieves the table column name from the database and adds it to the report.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.ReportAppServer.Controllers;
    using CrystalDecisions.ReportAppServer.ClientDoc;
    using CrystalDecisions.ReportAppServer.DataDefModel;
    namespace CS_Add_Field_inproc
        public partial class Form1 : Form
            // CR Declarations
            ReportDocument boReportDocument;
            ISCDReportClientDocument boReportClientDocument;
            CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;
            CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject boFieldObject;
            public Form1()
                InitializeComponent();
                //Create a new ReportDocument
                boReportDocument = new ReportDocument();
                // load the RPT file
                boReportDocument.Load("..
    AddField.rpt");
                //Access the ReportClientDocument in the ReportDocument (EROM bridge)
                boReportClientDocument = boReportDocument.ReportClientDocument;
                //Get the first section in the details section
                   boSection = boReportClientDocument.ReportDefController.ReportDefinition.DetailArea.Sections[0];
                   //Create the field object that we will add to the report and set all of its properties
                   boFieldObject = new CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject();
                //Set which field to use for the data to be displayed
                   boFieldObject.DataSourceName = "{Customer.City}";
                   boFieldObject.FieldValueType = CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeStringField;
                   boFieldObject.Left = 4 * 1440; //1440 twips per inch
                   boFieldObject.Width = 3 * 1440;
                   boFieldObject.FontColor = new CrystalDecisions.ReportAppServer.ReportDefModel.FontColor();
                   boFieldObject.FontColor.Font.Name = "Arial";
                   boFieldObject.FontColor.Font.Size = 10;
                   boFieldObject.Format.HorizontalAlignment = CrystalDecisions.ReportAppServer.ReportDefModel.CrAlignmentEnum.crAlignmentLeft;
                   //Add the object to the report
                   boReportClientDocument.ReportDefController.ReportObjectController.Add(boFieldObject, boSection, -1);
                // show in reportviewer
                crystalReportViewer1.ReportSource = boReportDocument;
            private void button1_Click(object sender, EventArgs e)
                //Get the first section in the details section
                boSection = boReportClientDocument.ReportDefController.ReportDefinition.DetailArea.Sections[0];
                //Create the field object that we will add to the report and set all of its properties
                boFieldObject = new CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject();
                //Set which field to use for the data to be displayed
                boFieldObject.DataSourceName = "{Customer.City}";
                boFieldObject.FieldValueType = CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeStringField;
                boFieldObject.Left = 4 * 1440; //1440 twips per inch
                boFieldObject.Width = 3 * 1440;
                boFieldObject.FontColor = new CrystalDecisions.ReportAppServer.ReportDefModel.FontColor();
                boFieldObject.FontColor.Font.Name = "Arial";
                boFieldObject.FontColor.Font.Size = 10;
                boFieldObject.Format.HorizontalAlignment = CrystalDecisions.ReportAppServer.ReportDefModel.CrAlignmentEnum.crAlignmentLeft;
                //Add the object to the report
                boReportClientDocument.ReportDefController.ReportObjectController.Add(boFieldObject, boSection, -1);
                // show in reportviewer
                crystalReportViewer1.ReportSource = boReportDocument;

  • Dynamic report columns in parameterized report

    Hi all,
    Just wanted to share some ideas... I was looking for a way to allow users to seect which columns to display in a parameterized report.
    I came across Denes Kubicek's solution on his APEX demo site (the "Pick Columns" page)... works beautifully.
    The only problem I had was that some of the report columns required joins to other tables. (up to 5 left outer joins). Could not figure out how to do this based on Denes sample solution. I then thought of creating a view, which joined all the required fields for output. I then run my report against the view... this works even better.
    I also used a shuttle instead of a multi-select list, since I have about 25 columns to pick from... I find the shuttle a lot more flexible (re-ordering of columns etc..)
    One thing I still haven't figured out yet though, is how to make the columns sortable? If I check off the sort check box on the report atttributes for the generic "col0"... I get an oracle error...
    If anyone has figured this one out, please let me know..
    Thanks to Denes for the solution...
    Stephane

    Actually, getting the error, albeit intermittently...
    Here is the SQL debug output
    select ECC_No,Opportunity_Name,Opportunity_Status from custom_report_vw where NVL(opportunity_type_id,-1) = decode(:P12_type_id,-1,NVL(opportunity_type_id,-1),:P12_type_id) and NVL(DEPARTMENT_ID,-1) = decode(:P12_dept,-1,NVL(DEPARTMENT_ID,-1),:P12_dept) and 
    NVL(max_5_effort_days,'%null%') = decode(:P12_5_EFFORT_DAYS,'%null%',NVL(max_5_effort_days,'%null%'),:P12_5_EFFORT_DAYS) and
    NVL(IN_FLIGHT,'%null%') = decode(:P12_IN_FLIGHT,'%null%',NVL(IN_FLIGHT,'%null%'),:P12_IN_FLIGHT) and NVL(CLIENT_FUNDED,'%null%') = decode(:P12_CLIENT_FUNDED,'%null%',NVL(CLIENT_FUNDED,'%null%'),:P12_CLIENT_FUNDED)  and 
    NVL(opportunity_category_id,-1) = decode(:P12_category_id,-1,NVL(opportunity_category_id,-1),:P12_category_id) 
    and NVL(priority_id,-1) = decode(:P12_priority,-1,NVL(priority_ID,-1),:P12_priority) and 
    NVL(work_type_id,-1) = decode(:P12_WORK_TYPE,-1,NVL(work_type_id,-1),:P12_WORK_TYPE)
    order by 4,1
    failed to parse SQL query:
    ORA-01785: ORDER BY item must be the number of a SELECT-list expressionFor some reason, in the order by it puts 4,1... but I only have 3 columns in my select list...
    If I choose an additional column, then the query works. I'm also confused as to why it sorts on the 1st column as well? In my report attributes, I do not specify a sort sequence, so I figure it would simply sort on the chosen column index.
    This query used was working fine yesterday with one or two columns...
    Any ideas?

Maybe you are looking for