Array in formula to use in a cross-tab

Post Author: eliasc
CA Forum: Formula
I am using CR 10.  I have a report where I am using a formula to use as a column header for a cross-tab.  Below is an example of what I am trying to achieve.
ATLANTA INVOICE  ATLANTA SERVICE  ATLANTA WARR.  BIRMINGHAM INVOICE BIRMINGHAM SERVICE BIRMINGHAM WARR.  ETC..
Below is the array in my formula.
Shared NumberVar i;Shared StringVar CompanyName;Shared StringVar Array Companies := ["HFSE - FW","ATLANTA INVOICE","ATLANTA SERVICE","ATLANTA WARR.","BIRMINGHAM INVOICE","BIRMINGHAM SERVICE","BIRMINGHAM WARR.","BGSI INVOICE","BGSI SERVICE","BGSI WARR.","PEN INVOICE","PEN SERVICE","PEN WARR.","JACKSON INVOICE","JACKSON SERVICE","JACKSON WARR.","FORT WORTH INVOICE","FORT WORTH SERVICE","FORT WORTH WARR.","JAX INVOICE","JAX SERVICE","JAX WARR.","LOUISVILLE INVOICE","LOUSIVILLE SERVICE","LOUISVILLE WARR.","OKLAHOMA CITY INVOICE","OKLAHOMA CITY SERVICE","OKLAHOMA CITY WARR."];0;
local stringvar tString;shared numbervar CompName;
CompName :=UBound(Companies) +1;i := CompName;
For i := 1 to CompName step 1 do(  ReDim Preserve Companies[i];    tString :=Companies[i] );
tString;
Can someone please help me.  I don't know where I am going wrong and why it isn't putting the above names in the cross-tab columns.
Thank you for your help.
Chris

Hi,
The "buffer" variable in DIG_Block_Out is an array of short integers (16 bit integers). It expects you to pass the array pointer as the function value. In the example below, "buffer" would be the parameter value.
Dim buffer(5) as Integer
Ron

Similar Messages

  • Is there a limit to no. of summary fields that can be used in a cross tab?

    Hi,
    While creating a cross tab is there a limitation to number of summarized fields that can be used?
    - The cross tab when uses 184 fields as summary fields leads to Crystal report application to crash at the time of export to excel.
    - Tried with two Datasources: XML and excel
    - If we reduce the number of summary fields used to 102 exactly, export works fine in excel.
    - If 2 cross tabs are used each containing 92 summary fields(in order to show 184) export to excel works fine.
    Please let me know if there is any such limitation which leads to CR application to crash when exporting in excel?
    Thanks
    Regards,
    Nidhi

    I suggest you purchase a case and have a dedicated support engineer work with you directly:
    http://www.sdn.sap.com/irj/boc/gettingstarted
    Or
    http://store.businessobjects.com/store/bobjects/Content/pbPage.CSC_map_countyselector/pgm.67024400?resid=jFmmLgoBAlcAAALO-iYAAAAP&rests=1278687224728
    If this is a bug you'll get a refund, if not post your enhancement request in the Idea Place. Or the Rep will suggest a better way to create your report.

  • Bug – CR 2011 cross tab number decimal formula not executing

    I have a formula to format the number of decimal points in both the column and row header values in a cross tab subreport. The formula does not appear to execute.  If I display the data in a simple table format and use the same decimal formula the format is correct.
    cross tab header, decimals not displayed correctly
    Data when displayed in a simple table using the same formula, decimals are displayed correctly

    Hi Paul,
    Here's another way:
    Remove the formula you've used under 'Decimal' for the cells in the crosstab.
    Right-click one of the cells > Format Field > Common tab > Click the formula button beside 'Display String' and use this code:
    numbervar x := CurrentFieldValue;
    numbervar ipart; 
    numbervar decpart; 
    ipart := int(x) ; 
    decpart := x - ipart;
    if ipart > 0 then
    totext(ipart,0)
    else if decpart > 0 then
    Replace(totext(decpart),"0","")
    -Abhilash

  • Creating a Cross tab that contains fields with shared variables

    I am trying to create a cross tab in CR2008. I can get the field in the details but cannot choose it when trying to create a cross tab. Please help.
    Thanks.
    Shared numbervar MonHrs;
    Shared numbervar TueHrs;
    Shared numbervar WedHrs;
    Shared numbervar ThuHrs;
    Shared numbervar FriHrs;
    Shared numbervar SatHrs;
    Shared numbervar SunHrs;
    If dayofweek(today) = 1
        then {@CapacityTeamCount} * SunHrs else
    if dayofweek(today) = 2
        then {@CapacityTeamCount} * MonHrs  else
    if dayofweek(today) = 3
        then {@CapacityTeamCount} * TueHrs else
    if dayofweek(today) = 4 
        then {@CapacityTeamCount} * WedHrs else
    if dayofweek(today) = 5
        then {@CapacityTeamCount} * ThuHrs else
    If dayofweek(today) = 6
        then {@CapacityTeamCount} * FriHrs else
    if dayofweek(today) = 7
        then {@CapacityTeamCount} * SatHrs

    I don't use CR cross tabs as a matter of preference so I can't tell you if the shared variables are having an impact on their availability in the cross tab dialog or how to make the necessary adjustments...
    I can, however, tell you that you don't need a cross tab for what you are trying to do. All you need to do is split all of the IF formulas in to their own formulas.
    This will place each day in it's own column.
    Now... you'll notice that there's a lot white space and nothing's aggregated... Not to worry, it's easy to fix.
    Just create a grouping on which ever field you were going to use as "rows" in the cross tab... insert SUM totals in the group header... and hide the details.
    Now you have created your own manual cross tab, without using CR's cross tab object.
    HTH,
    Jason

  • Displaying Alternate row as colored in Cross tab

    Hi,
    I have a report where I need to display alternate rows as colored.
    There is some data in detail section followed by a cross tab in the report header section.
    While I am able to display alternate rows as colored in Detail secction for displaying alternate colored rows in Cross tab data I need some help.
    Data in cross tab is like this
                  history geography
    Tammy   90          60
    Sid         80          50
    Julia       70        40
    In cross tab for displaying alternate colored rows ie for alternate student names  I am using two formulas
    - for displaying row values I am using this one
    whileprintingrecords;
    numbervar d;
    d := iif(d=100,255,100);
    color(255,255,d);
    For displaying alternate colored inner cells ie marks  I am using this formula
    whileprintingrecords;
    numbervar c;
    c := iif(c =255,100,255);
    color(255,255,c)
    I got these formulas after doing Googling
    My cross tab is present in report footer and in the generated report it comes separeated in two pages.
    In the first page data for Tammy and Sid is displayed while Julia is displayed on next page.
    Now the Tammy is coming as yellow colored and as expected Sid is coming as white colored. However Julia which is on next page is coming as white , but logically it should have come as yellow. On the other hand my column data ie marks column is coming fine. Data for tammy and sid is coming as alternately colored and data is Julia on the next page is coming as yellow(as data for Sid is in white)
    I am not able to understand why this is happening and what is the correct way to do alternate row coloring in cross tabs
    Edited by: thunderball10 on Aug 26, 2010 11:57 AM
    Edited by: thunderball10 on Aug 26, 2010 12:00 PM

    Where is your variable c being reset.
    If in page header or group header and you have repaet group header on new page then c will be reset on each page.
    If In groupheader try adding this to reset formula
    if not inrepeatedgroupheader then
    Ian

  • Totals in a cross tab report

    I'm working with Crystal Reports XI.  We have an existing report that was created using the Cross-tab report type.
    There are 3 summary fields in the report:
    - direct cost
    - indirect cost
    - Total ( direct cost + indirect cost)
    Everything worked fine until now because both the direct cost and the indirect cost were being rounded to 2 decimal places.  However, I have a new requirement to round the indirect cost total to a whole dollar ( no decimal places) before adding it to the direct cost total.  This creates a problem for the third summary field because I'm only able to do:
    - create a formula field of (direct cost + indirect cost rounded to a whole dollar)
    - use that amount in the summary field
    The problem is that then the indirect cost is being rounded for EACH record separately.  But what I need to to calculate the Total indirect cost first and only after I have that total rounded to a whole dollar, add it to the direct cost total.
    So basically, I would like for the third row to simply show the sum of the first row and the second row.
    I can't take the current total ( direct cost + indirect cost) and then round this total because the rounding for the total direct cost needs to be done in a different way than the rounding for the indirect cost total.
    Is that possible with the cross-tab report type?  Is it possible to have 2 running totals in a cross tab report and then have a custom field in the report that rounds each using the appropriate rounding algorithm and then adds the two up.
    thanks

    Thank you for your suggestions.  I kind of suspected that I wouldn't be able to use the current cross tab report to achieve this but since I've never worked with a cross tab report before I wanted to make sure this is the case before investing the time to do it some other way.
    I will try using the manual cross tab report as you suggested.
    Thanks again.

  • How to calculate difference in cross tab report

    Hello All,
    I have a cross tab report . I have values for 2 KPI's no of employees joined and no of employees left organization on monthly basis.
    I want to calculate employees Joined - employees left organization.
    Please let me know how can we achieve this.
    PFA the sample report.
    Regards
    Prasad Ambati

    Hi Prasad,
    I think you want the difference between the two columns in the cross tab i.e.
    "Count of Joinees" (lets say V1) and "Count of employees left the organisation" (lets say V2)
    For achieving this you can do:
    1. Create a variable V1 (as measure) for "Count of Joinees" as you have already used in your cross tab (1st Column), just create a variable for it.
    2. Create another variable V2 (as measure) for "Count of employees left the organisation" as you have already used in your cross tab (2nd column) just create a variable for it.
    3. Add a column next to "SUM" insert the formula =[V1]-[V2] 
    I think this should work just try it.
    Thanks,
    Shardendu Pandey

  • Seconds to Time Conversion for Display on a Cross-Tab

    Post Author: [email protected]
    CA Forum: Formula
    I am doing a cross-tab report of login times for hours logged into a system. In the cross-tab if i use the time, I can't sum. So i have the time converted to seconds to allow for a sum and totals.  Now I need to change the display of the field to time.   When I go to my Format Field of the field in seconds, under Common tab i go to Display String.  I put in the following formula: totext((/60)/60,0,"","") & ":" & totext(truncate(remainder(/60,60)),0) & ":" & totext(remainder({Secondin_Logins.T},60),0);   My problem is it changes all to report the same time; no time is different. And the formula is wrong becuase when i do the hours if it is .501 or high it rounds up. Anyone have any solutions to convert seconds to Time?

    Post Author: V361
    CA Forum: Formula
    Part of the probem may be the crosstab,   any way, this example uses a group but should be generic enough to give you some ideas.
    whileprintingrecords;
    StringVar Hours1;
    StringVar Minutes1;
    StringVar Seconds1;
    NumberVar time2;
    time2:= 0;
    if Sum ({Work Time}, ) = 0 then 0 else
    time2:= Sum ({Work Time}, );
    If time2 <= 0 Then
    "00:00:00"
    Else
    ( Hours1:=ToText(Truncate(time2/3600),0);
    Minutes1:=ToText(Truncate(Remainder(time2,3600)/60),0);
    Seconds1:=ToText(Remainder(Remainder(time2,3600),60),0);
    //Display the time formated.
    (if length(Hours1) < 2 then '0') + Hours1 + ":" +
    &#91;"0",""&#93;&#91;length(Minutes1)&#93; + Minutes1 + ":" +
    &#91;"0",""&#93;&#91;length(Seconds1)&#93; + Seconds1);

  • Conditional highlighting on cross-tabs

    Does anyone know if it is possible to conditionally highlight a field in cross-tab based on another field in the table? The field we&#39;re using to condition is not in the cross-tab, nor do we want it to be in the cross-tab. We need to highlight a report field based on another field from each record reported. Highlight expert won&#39;t let you highlight the field unless the field is in the cross-tab.

    yes it is possible
    Select the field from Cross Tab which you want to Highlight Right Click Select the Format Field
    Select the Font TabÂ
    Select the formula button next to color
    Then enter the formula
    IF field not in cross tab = somevalue then
    mention the Color Code which you want....
    Thanks
    Rahul

  • Decode or Cross tab

    Hi all,
    Pls help me in fiding the solution for the for following query..
    select a.user_id,b.description,a.module_id,a.access_id from module_access a ,module b
    where a.module_id = b.module_id
    user id description Module id Access id
    ======= ========== ========= ============
    TEST6     Asset     1     1
    TEST6     Asset     1     2
    TEST6     Department     2     1
    TEST6     Department     2     2
    But I need the output to be as follows
    user id description Module id Access id Acc1
    ================ ======== ======= ====
    TEST6     Asset     1     1 2
    TEST6     Department     2 1     2
    Is it possible using Decode or cross tab
    Thanks ....
    Edited by: muthusamy on Feb 19, 2009 3:19 AM

    Whenever you are posting any problem please post your table with some sample data like this way ->
    WITH GGTT
    AS
        select 1234 empno, to_date('1-1-09','DD-MM-RR') da_te, 0 units from dual
        union all
        select 1235, to_date('2-1-09','DD-MM-RR'), 0 from dual
        union all
        select 1237, to_date('5-1-09','DD-MM-RR'), 0 from dual
        union all
        select 1245, to_date('6-1-09','DD-MM-RR'), 1 from dual
        union all
        select 1239, to_date('10-1-09','DD-MM-RR'), 0 from dual
        union all
        select 1235, to_date('13-1-09','DD-MM-RR'), 0 from dual
        union all
        select 1237, to_date('25-1-09','DD-MM-RR'), 2 from dual
        union all
        select 1239, to_date('27-1-09','DD-MM-RR'), 0 from dual
        union all
        select 1238, to_date('30-1-09','DD-MM-RR'), 0 from dual
    SELECT *
    FROM GGTT;That will help us to concentrate on the main problem.
    And, how do you get this kind of formatted post?
    Here is the way ->
    {{noformat}code{noformat}}
    ..... Your Formatted Data .....
    {{noformat}code{noformat}}
    And, it will look like ->
    ..... Your Formatted Data .....Got me?
    Regards.
    Satyaki De.

  • Record selection issue in cross tab.

    Hello!
    I have a record  filtering problem. I tried many scenarios, and searched this forum but I cannot find an solution.
    I have a sub-report that contains a cross tab that provides a few summarized fields.
    I have two tables: a table with category of events : (field catID and Catname) and an event table with a CatID, a date field and others number field I use in the cross tab.
    I want my cross tab to show one row per category. The Catname and the summaries.
    Now all is working fine but for one issue. I need to select my event according to a time bracket.
    So I created two time parameters (start and end) and select the event dates between these two dates.
    Now, when selected, any category that does not have an event between these dates are not displayed. I would like them to be shown with "o" values.
    There must be a way of doing this. I just cannot find it.
    Esther

    In order for Crystal to show data, it must be given data to show!
    You will need to base your subreport on an SQL Command.  In that command, put the current SQL used by the report.  To this, do a UNION to a select that selects the category name, and a zero for each field that you are summing in the crosstab.
    As a simplified example, suppose the original SQL was (MS SQL):
    select c.catname, sum(e.quantity) as Quantity
    from categories c, events e
    where c.catid = {?catid parm}
    and c.catid = e.catid
    and e.date between {?start} and {?end}
    This would be changed to
    select c.catname, sum(e.quantity) as Quantity
    from categories c, events e
    where c.catid = {?catid parm}
    and c.catid = e.catid
    and e.date between {?start} and {?end}
    UNION
    select c.catname, 0 as Quantity
    from categories c
    where c.catid = {?catid parm}
    This will return an additional zero record, regardless of what data the original query returns, thus giving Crystal the data needed to display.  Note that the zero value will not affect the results in any way, except causing a zero to be displayed if no data is returned from the original query.
    Just remember that the second SELECT in the UNION has to have the same number of fields, of the same data type, as the first SELECT.
    HTH,
    Carl

  • Cross Tab - Suppress info

    Post Author: llcoolt
    CA Forum: Formula
    I just created a cross tab report that works beautifully, with one exception.... I want to suppress one of the column headings.  How do I suppress ONE column sumary and it's heading?  The heading is called "Job Cost" and is further defined as any cost code that <> &#91;"61" to "76"&#93;, if that helps. 
    Thank you for all of your help.

    Post Author: V361
    CA Forum: Formula
    go to crosstab expert, you should be able to click on the fields you mentioned and just suppress them.

  • Problem using a conditional suppress in a cross-tab ?

    is there a problem using a conditional suppress in a cross-tab on a row  or summarized field  in crystal XI?
    I am using the following conditional suppress on a summarized field and its rows
             If {@SortCode}=4 then true;
    Sortcode is a group sorting formula field
    the summarized field is a formula field as well.
    All of the summarized fields are suppressed although the cross- tab performs correctly on @Sortcode  and the summarized field when not using the condition        
    it seems to me to be a reporting flow issue although i've included "whileprintingrecords" and "evaluateafter" with no success.
    i have also moved the cross-tab from the report header to group header and applied a conditional suppress on the group header through section expert.
    this supresses the group i dont want but includes grand totals for each group and also varys the number of columns
    i can't filter on sortcode because one of the grand total calculations requires those records and a subreport or second cross-tab does not contain the same number of columns
    the cross-tab is necessary as a client may have columns spanning one to many pages
    thanks for your help

    Hi I have a similar problem,
    I have an clock in solution, where i have some dates with data such as, various entries for a date eg, 01/11/2010 1hr, 01/11/2010 3 hrs etc, 03/11/2010 2hrs , 05/11/2010 4.5hrs, 05/11/2010 4 hrs so i need total for each day and highlight only those days, where total is less than 4.5, including days which donu2019t have records eg 02/11/2010 & 04/11/2010, I summarise in totals using a cross tab, to get summarised output for each day as,
                Totals
    01/11/2010    4
    03/11/2010    2
    05/11/2010    8.5
    in order to get the dates which didnu2019t have records, i added a dataset from Excel spreadsheet where i just have a sequential dates for the year , and use record selection to select only those dates in range which i need to display, so the result i get
    01/11/2010    4
    02/11/2010    0
    03/11/2010    2
    04/11/2010    0
    05/11/2010    8.5
    so far so good, all using cross tab, now i want to suppress rows which have total > 4.5 so the result should be
    01/11/2010    4
    02/11/2010    0
    03/11/2010    2
    04/11/2010    0
    How can i do that?

  • Custom formula in cross-tab?

    I have a cross-tab like this
                      JAN    FEB    MAR ....... DEC (the 12 months as columns)
    year 2006
       item 01     150    205      300 .......    550
       item 02       80    190      284 ........   620
    year 2007
       item 01      458    235      224 .......... 781
       item 02      154    254      134..........  254  
    year 2008
       item 01       245    154      544           1243
       item 02       524    254      124 .........   924     
    I want to know if is possible to have a formula that take the value of each month and compare with the previous and make a calcule like this...
                      JAN    FEB    MAR ....... DEC (the 12 months as columns)
    year 2006
       item 01     150    205      300 .......    550
       item 02       80    190      284 ........   620
    year 2007
       item 01      458    235      224 .......... 781
                       (205)   (14)
       item 02      154    254      134..........  254  
    year 2008
       item 01       245    154      544           1243
       item 02       524    254      124 .........   924 
    where (205) and   (14) are calculate from:
    (205) = (150 - 458) * 100 / 150 I have to  make this operation for each month takin the values from item 01 from 2006 with the values from item 01 from 2007 and so on
    Edited by: j jara on Jul 22, 2008 2:01 AM

    Yes it is possible.
    It would be easier in CR2008  where you have the ability to add Calculated Members.
    In previous versions you would need to create a variable for each year and using the GridRowColumnValue function assign the current value to a variable. You would then need to add a second summary field as a "dummy" summary and in the Display string formula declare the variables and manipulate the values as you like and finally convert the output to string.

  • Use of variables in cross tab

    Hi experts,
    Can anyone tell me how to use a variable in cross-tab?
    I am populating the crosstab from the columns of a table.
    I want to use a variable (say percentage of averages) which calculates for each month for any number of months the data has been generated.
    Ex: Demo is my table and contains two average fields - average1 and average2 generated once for each month.
    Now I want a variable which calcaulates for each month, their variance based on some formula like (average1-average2)/average1.
    I have created a variable which calculates according to the above formula but its value is getting repeated for each month (the value of the first month) . It is not giving me the value corresponding to each month.
    Request you to help me.
    Thanks,
    Roshan

    Hi,
    Thanks for the reply.
    I have the following data from the cross tab.
         Jan     Feb     March
    Average 1     25     35     50
    Average 2     20     20     35
    Average 3     15     10     25
    And i want to generate the following structure dynammically based on the number of months/quarters.
         Jan     Var %     Feb     Var %     March     Var %
    Average 1     25          35          50     
    Average 2     20     20     20     42.85     35     30
    Average 3     15     40     10     71.42     25     50
    The new columns in the crosstab display should be dynamically generated.
    Request you to help me generate the new columns and the values.
    I have created this table in MS-Excel for reference.
    Thanks,
    Roshan

Maybe you are looking for

  • How to insert the file name to column

    When user upload the file, in order to avoid the double file name conflict, so I need to  change the file name to something else, but I still need save the former file name to some column to download the file with correct file name, I know how to ren

  • Why does search engine drop down menu only works once?

    I'm quite happy with the new Safari 4 (first time user) but I'm frustrated by only being able to select once with my mouse from the 'Recent Searches' drop down window. Let me explain. After I launch Safari 4, I'm able to use my mouse and select one o

  • Insert a " in a string

    Hi, I want to assign following text to a string: Projection 8, 112, "m", 10.38147072 I would like to do it as follows: String text; text = "Projection 8, 112, "m", 10.38147072; The thing is that the "m" could not be inserted in this string. Unfortuna

  • SRM-EBP approved purchase orders.

    Hi. In SRM, when an user (no approver user) click in Confirm Goods, he can see in browser the purchase orders created by himself. When approver user click in the same zone, i need that browser shows purchase orders created and in addition the purchas

  • Adding broadband to an existing package – is it po...

    A phone call from BT prompted me to look into adding broadband to my home phone line. The helpful sales person insists that the only way to do this is to take out a long contract, 12 or 18 months, and to accept a "free" router. The reason for the req