Calculated field in table

I have a MySQL table with 3 columns, tid, text1, text2
I put rowset in sessionbean and edit the SQLstatement like this
SELECT tID,
text1,
text2,
CONCAT(text1, ' ', text2) AS "totaltext"
from testtable
and runs the query.
Creator gives a errormessage about not beeing able to view graphicly,
but allow me to execute and views the result correctly, but without the
columnname "totaltext".
When adding a table on a page and Bind the to Data,
the calculated column is not available.
What am I doing wrong?

Solution
Use - mysql-connector-java-3.1.12-bin.jar - not the 5.0 beta version
The query editor in Creator still complains about the "(" but runs the query.
And now you will find the column alias name "totaltext" when you Bind the data to a table and the correct data is shown running the project.

Similar Messages

  • IF statement in Calculated Field for Share point, doesnt calculate sum in my Excel Pivot table.

    Hi Everyone
    I used this in SP calculated column field.
    =IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift
    Sched]="6pm to 3am","5",IF([Shift Sched]="7pm to 4am","6",IF([Shift Sched]="8pm to 5am","7",IF([Shift Sched]="9pm to 6am","8",IF([Shift Sched]="10pm to 7am","8",IF([Shift
    Sched]="11pm to 8am","7",IF([Shift Sched]="12pm to 9am","6",IF([Shift Sched]="1am to 10am","5",IF([Shift Sched]="2am to 11am","4",IF([Shift Sched]="3am to 12pm","3",IF([Shift
    Sched]="4am to 1pm","2",IF([Shift Sched]="5am to 2pm","1",IF([Shift Sched]="6am to 3pm","0",IF([Shift Sched]="7am to 4pm","0",IF([Shift Sched]="8am to 5pm","0",IF([Shift
    Sched]="9am to 6pm","0",IF([Shift Sched]="10am to 7pm","0",IF([Shift Sched]="11am to 8pm","0",IF([Shift Sched]="12pm to 9pm","0"))))))))))))))))))))))))    
    it was able to work fine however my issue is when i extract the information to excel and use a pivot table the table is not able to calulate the sum of the value for this field. Can you please help me with this. this is for an Attendance traker for Night
    Differential pay for employees. they create a daily log of their shift schedule and if i summarize this in pivot the value in the calculated field for this is not getting the sum.
    Thanks,
    Norman

    Hi Everyone
    I used this in SP calculated column field.
    =IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift
    Sched]="6pm to 3am","5",IF([Shift Sched]="7pm to 4am","6",IF([Shift Sched]="8pm to 5am","7",IF([Shift Sched]="9pm to 6am","8",IF([Shift Sched]="10pm to 7am","8",IF([Shift
    Sched]="11pm to 8am","7",IF([Shift Sched]="12pm to 9am","6",IF([Shift Sched]="1am to 10am","5",IF([Shift Sched]="2am to 11am","4",IF([Shift Sched]="3am to 12pm","3",IF([Shift
    Sched]="4am to 1pm","2",IF([Shift Sched]="5am to 2pm","1",IF([Shift Sched]="6am to 3pm","0",IF([Shift Sched]="7am to 4pm","0",IF([Shift Sched]="8am to 5pm","0",IF([Shift
    Sched]="9am to 6pm","0",IF([Shift Sched]="10am to 7pm","0",IF([Shift Sched]="11am to 8pm","0",IF([Shift Sched]="12pm to 9pm","0"))))))))))))))))))))))))    
    it was able to work fine however my issue is when i extract the information to excel and use a pivot table the table is not able to calulate the sum of the value for this field. Can you please help me with this. this is for an Attendance traker for Night
    Differential pay for employees. they create a daily log of their shift schedule and if i summarize this in pivot the value in the calculated field for this is not getting the sum.
    Thanks,
    Norman

  • Calculated field in qualified table

    Hello
    I have created three very simple calculations i qualified tables. The calculated field as well as the fields that make up the calculation are qualifiers.
    None of the calculated fields are updated!
    I have tried to hit the recalculate button and calculated fields in the main table work without problems.
    Is this a known limitation? What can I do to trigger the update?
    BR
    /Alexander

    Hi,
    This is not the case.
    Suppose in Qualified table, you have 4 fields one Non-Qualifier and three Qualifiers say FNAME, LNAME and FULLNAME all of type text.
    Now for Qualifier Field FULLNAME i define Property Calculated = Yes and In Calculation Expression I write as:
    CONCAT(FNAME,LNAME)
    So on updating Qualifiers Value value of Qualifier Calculated field FULLNAME get updated.
    Suppose intially for a record i have qualifiers value as
    FNAME LNAME
    Mandeep Saini
    FULLNAME = Mandeep;Saini
    when i update value for these two qualifiers for the same record
    FNAME LNAME
    Alexander Isacson
    then value in for Qualifier field FULLNAME get updated to Alexander;Isacson
    i tried this and it is working fine.
    Hope it will Help you,
    Rewards if found Useful....
    Mandeep Saini

  • Calculated non-base table field in a tabular form

    I am struggling with creating a non-base table calculated field in a tabular form in ApEx 3.1
    Can you point me in the right direction
    I thought this would be fairly easy to do, but I cant work out how to do it
    Requirements
    1) Tabular Form based on a table with QTY and PRICE columns
    2) TOTAL is a non-base table field, based on QTY * PRICE
    3) If the Qty or Price changes, the TOTAL should be re-calculated
    Example
    QTY   PRICE  TOTAL
    ===    =====  =====
    3       5          15
    10      50         500
    20      3           60
    Environment
    ApEx 3.1, Oracle 10 and Oracle 11 databases
    I recommended to upgrade to a newer version of ApEx but the request was rejected so Im stuck with 3.1

    Thanks, but its not the solution that I am after
    I am looking for a solution that will ...
           1) not require the calculated value TOTAL to be stored in the table
    and 2) re-calculate the TOTAL when I modify the dependent values (QTY and PRICE) before I save the changes to the database
    I am still looking for a solution if anyone can help

  • DAX Dynamic Banding | Calculated Member based on Calculated Field

    Good morning,
    I've created a Power Pivot model that measures the blood glucose levels of clinical patients at specific times of the day. The requirement is that this metric, let's call it GlucoseLevel, is always averaged as it wouldn't make sense to sum up the values.
    To meet this first requirement, I set the "Summarize By" property of the GlucoseLevel column to "Average".
    The second requirement is to band the GlucoseLevel values so that groups of people can be measured by this band rather than by the individual measure values. I created a banding table in Excel and then imported it into the Power Pivot model. The banding table
    has three columns (BandName, MinValue and MaxValue) and has the following values:
    VERYLOW: Min Value = 0; Max Value = 3.99
    OK: Min Value = 4; Max Value = 6.99
    WARNING: Min Value = 7; Max Value = 10.99CRITICAL: Min Value = 11; Max Value = 30.00
    It is at this point where I face my challenge. I have a GlucoseLevel measure and I have a banding table. Great. The challenge is: How do I create a calculated, dynamic
    member that will look at my GlucoseLevel measure (at whatever level), do a lookup to my banding table, and then return the "BandName" column from the Banding table at that specific level? So to clarify what I mean by level: I want to be able
    to view the bandings at Year level, or a Month level, or even at a week level. Then depending on what level I am at, my measure should have a Band associated to it.
    I've tried to solve this issue in a couple of ways:
    Attempt 1
    Create a calculated column in my fact table that contains a nested IF statement to manually band my GlucoseLevel values. This works fine if I view my data at the lowest level of granularity, however
    it does not work if I start looking at my data at the day, week, month etc. levels
    Attempt 2
    1.) Create a calculated field (not a calculated column) that averages my GlucoseLevel measure. This is cool because it will average my measure at whatever level I am viewing it at. Let's call
    this field Bob...
    2.) Band my measure Bob by creating another calculated field (called PatientBand). This field uses my banding table (described earlier) in conjunction with my calculated field Bob. This works perfectly, except for one big flaw: Excel sees this banding field
    as a measure, and not as something that I can use as a column / row...
    So my question is: Can I trick Excel into viewing my PatientBand calculated field as an attribute, and not as a measure? And if not, how do I get around this challenge? Here is the DAX formula that I used to create my second calculated field "PatientBand":
    PatientBand:=CALCULATE(
        VALUES (Bandings[BandName]);
        FILTER (
            Bandings; 
            Test[Bob] >= Bandings[MinValue]
         && Test[Bob] <= Bandings[MaxValue]
    Thanks!

    So there are 2 ways that I can think of for doing that.
    1) if you are only using MDX clients like Excel or Reporting services you can create a text based measure that returns the banding name. (Note that this sort of approach does not work at the moment with PowerView as it only displays numeric measures). This
    would effectively let you show a label next to a reading as opposed to moving the reading under a given banding column.
    Banding Name :=
    CALCULATE (
        VALUES ( Bands[BandName] ),
        FILTER (
            Bands,
            [Average of GlucoseReading] >= Bands[BandMin]
                && [Average of GlucoseReading] <= Bands[BandMax]
                && NOT ( ISBLANK ( [Average of GlucoseReading] ) )
    2) This next approach will show the results exactly as you had them in your sample screenshots. It just takes a slight bending of the DAX. I'm using a SUMX here, not because I want to sum anything, but because the "X" version of SUMX basically loops over
    every row in the specified table and sums the expression in the second parameter. I have setup the second parameter so that it only returns a single value for the average if it is in the appropriate banding. 
    Banded Average:=IF (
        HASONEVALUE ( Bands[BandName] ),
        SUMX(
            'Bands',
            IF (
                NOT ( ISBLANK ( [Average of GlucoseReading] ) )
                    && [Average of GlucoseReading] >= MIN ( Bands[BandMin] )
                    && [Average of GlucoseReading] <= MIN ( Bands[BandMax] ),
                AVERAGE(Readings[GlucoseReading]),
                BLANK()
    ,AVERAGE(Readings[GlucoseReading])
    http://darren.gosbell.com - please mark correct answers

  • New Calculated field question. Complicated I think.

    I have managed to create this table from a MySQL database: http://ppbm5.com/DB-PPBM5.php
    The field 'Total' is a calculated field using this SQL query:
    $query_Recordset1  = 'SELECT *, `Disk I/O`+`MPEG2-DVD`+`H264-BR`+IFNULL(`MPE On`,`MPE  Off`) As Total, `CPU`*`Cores` As Phys_Cores FROM `Personal_data` WHERE 1  ORDER BY (`Disk I/O`+`MPEG2-DVD`+`H264-BR`+IFNULL(`MPE On`,`MPE Off`)),  `Date & Time` ASC';
    So far, so good, but as you may have  noticed, there is a next field called 'Rel. Perf.' which only contains  blanks. And that is where my problems start.
    The table is sorted by 'Total' and the first record shows these figures and field names that are relevant for my question:
    Fields: 'Total'  'Disk I/O'  'MPEG2-DVD'   'H.264-BR'   'MPE On'   'MPE Off'
    Values:  131,        67,              21,                  37,              6,              64
    In addition, I use four 'weight' figures, let's say these are 0.27 , 0.30 ,  0.20 and 0.23 denoted as W1, W2, W3, W4.
    First step is to calculate four temp values, using a formula like this resulting in T1, T2, T3 and T4:
    T1 = W1 x  Total /Disk I/O; T2 =  W2 x Total/MPEG2-DVD ; T3 = W3 x Total/H.264-BR ; T4 = W4 x Total/(IFNULL(MPE On, MPE Off)
    Note that this only applies to the top record and here the SUM(T1, T2, T3, T4) results in 131, equal to the Total.
    The result of 100 x SUM(T1, T2, T3, T4)/ Total = 100 should be the 'Rel.Perf.' result for the top record.
    Now  is gets difficult. Let me call the records R1, R2, R3, ..., Rx. Now, in  the previous step we have established that the figure 100 should into  R1.
    For R2 the result of the 'Rel.Perf.' is 100 x SUM(T1 x Disk  I/O(2), T2 x MPEG2-DVD(2), T3 x (H.264-BR(2), T4 x (IFNULL(MPE on, MPE  Off)))/ Total(2)
    For R3 the result of the 'Rel.Perf.' is 100 x  SUM(T1 x Disk I/O(3), T2 x MPEG2-DVD(3), T3 x (H.264-BR(3), T4 x  (IFNULL(MPE on, MPE Off)))/ Total(3)
    etcetera for all the rest of the records in the table.
    A  complicating factor is that the reference point of the top machine  should remain fixed at 100, but when doing queries, the top machine may  not be in the query results, but all the query results for the Rel.Perf.  should be derived from these scores. Life would be infinitely easier if  one would be certain that the top machine is fixed, but that is not the  case.
    Sorry to make this such a long and complicated post, but  for those who have struggled through this long message, if you have any  suggestions on how to make this work, I would appreciate it.
    Thanks in advance.
    Harm, while non is intended.
    PS. I have been trying to generate a SQL query, using the following code:
    $query_Recordset1 = 'SELECT *, FORMAT(`Disk I/O`+`MPEG2-DVD`+`H264-BR`+IFNULL(`MPE On`,`MPE Off`),0) As Total, FORMAT((54.661*`Disk I/O`+161.25*`MPEG2-DVD`+71.66666*`H264-BR`+645*IFNULL(`MPE On`,`MPE Off`))/129,1) As RPI,`CPU`*`Cores` As Phys_Cores FROM `Personal_data` WHERE 1 ORDER BY 54.661*`Disk I/O`+161.25*`MPEG2-DVD`+71.66666*`H264-BR`+645*IFNULL(`MPE On`,`MPE Off`), `Disk I/O`+`MPEG2-DVD`+`H264-BR`+IFNULL(`MPE On`,`MPE Off`) ASC';
    For static work it is OK, but not when a new top performer submits his data.

    Hi William,
    Per my understanding that you want to count the number of the value in the field wait which is smaller then 15, right?
    I have tested on my local environment and that you can add the calculated field (Count) using the expression as below:
    =IIF(Fields!wait.Value<15,1,0)
    Insert an outside group row and then get the total count by using below expression:
    =SUM(Fields!Count.Value)
    Preview you will get the result like below:
    If your problem stil exists, please try to provide some sample data and the exprect count result you want.
    Any problem, please feel free to ask.
    Regards
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Calculation Field to be mapped to different data object's column name in Oracle BAM 12c

    Hi,
    I am having a challenge to enable drill down to 2nd level report by passing calculation field as parameter.
    As an alternative, I am thinking to point calculation field to another data object’s column name and generate report so that I would be able to pass that as parameter to drilling report view.
    Is there any way to map calculation field to different Data object’s column name? Thanks in advance.
    Regards
    Amik Basu

    1. Yes, you can.
    SQL> create table ÜÝÞ( ßàá number(10));
    Table created.
    SQL> insert into ÜÝÞ values (10);
    1 row created.1.1 and 1.2 and 2. You can choose UTF as your default character set. It allows the user of non-English characters in VARCHAR columns in your whole database. It is not per tablespace.
    SQL> create table ÜÝÞ( ßàá varchar2(100));
    Table created.
    SQL> insert into ÜÝÞ values ('âãäçìé');
    1 row created.

  • Calculated Field is Disable while using PowerPivot to access multiple sheet column in a single pivot,

    Hi,
    I am trying to add a calculated field in my power pivot table to show the percentage on the basis of 2 columns, please let me know why this is not appearing and how can i fix it.
    Any other way if i can add a calculated field in the pivot table will be very helpful.
    Thanks
    Aman

    Thanks KR for the response,
    Yes I loaded multiple tables in the data model and using PoewrPivot ,
    i have a rating column, in that i have 0,1,2,3,4,5 rating numbers and we call it "Total expected occurrence",
    a single person can get same rating multiple times, if a person is getting >=4 rating no. we call it "Occurrence >= 4". now i have to find out the total
    count of "Occurrence >=4" for a particular person from "Total expected occurrence" column,
    once will get the  net "Occurrence >=4" for everyone, it should divide
     "Occurrence >=4"/ "Total expected occurrence" to take out the percentage of rating 4 for a particular person  
    Best Wishes,
    Aman verma

  • Updatable property of Calculated Field in ViewObject does not work

    Hello,
    I have set the Updatable property of some ViewObject attributes to "while new".
    In the page those attributes are shown as <af:inputListOfValues> components.
    When creating a new row, those components properly appear as enabled and let me insert any values, since the row is new.
    However, after a following commit, once the table in the page is refreshed, I still see some components enabled on the row I committed before. This only happens with attributes based on calculated fields, not with those based on real table fields, as if the "while new" property specified on the ViewObject calculated fields was ignored.
    Do you know why? Is there a solution or work around?
    Below are the ViewObject XML section and the af:component definition based on the attribute.
    <ViewAttribute
    Name="Cod"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="15"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="COD"
    Expression="COD"
    SQLType="VARCHAR"
    IsUpdateable="while_insert"
    LOVName="LOV_Cod">
    <DesignTime>
    <Attr Name="_DisplaySize" Value="15"/>
    </DesignTime>
    <Properties>
    <SchemaBasedProperties>
    <CONTROLTYPE
    Value="input_text_lov"/>
    </SchemaBasedProperties>
    </Properties>
    </ViewAttribute>
    <af:inputListOfValues id="ilov1"
    popupTitle="Search and Select: #{bindings.BLOCK.hints.Cod.label}"
    value="#{row.bindings.Cod.inputValue}"
    model="#{row.bindings.Cod.listOfValuesModel}"
    required="#{bindings.BLOCK.hints.Cod.mandatory}"
    columns="#{bindings.BLOCK.hints.Cod.displayWidth}"
    shortDesc="#{bindings.BLOCK.hints.Cod.tooltip}"
    autoSubmit="true">
    <f:validator binding="#{row.bindings.Cod.validator}"/>
    </af:inputListOfValues>

    Helga,
    The question is what does this "require" flag do? We read the book of life (cl_htmlb_inputfield), and see that this flag only controls in the first instance a little red * that is rendered next to the input field. This is a pure visualization for the user of the page.
    In addition you can ask that a check be done in the browser. This you can do with:
      <htmlb:inputField  id = "wander"
                         value = "E"
                         required = "TRUE"
                         doValidate="true" />
    However, I would not serious recommend this. Now even if you user presses a cancel button, or link, or breadcrumb, or..., the check will still complain.
    What we currectly do (and recommend), is to set the required flag on the <htmlb:<b>label</b>/> tag. And then do the actual checking on the server (must be done in anycase). If no value, or not correct, then also set the "invalid" flag, render out error message and redo page.
    ++bcm

  • Running total of calculated field in pivot

    VERSION: ORACLE 11
    TABLE:
    create table chart_detail (
    DIS        NUMBER,
    BLD_MO VARCHAR2(7),
    BLD        NUMBER(10),
    RPLC      NUMBER(10));DATA:
    insert into chart_detail values (60,'2011-03',0,2);
    insert into chart_detail values (150,'2011-04',10572,0);
    insert into chart_detail values (120,'2011-04',26449,5);
    insert into chart_detail values (30,'2011-04',0,1);
    insert into chart_detail values (60,'2011-04',0,7);
    insert into chart_detail values (90,'2011-04',0,9);
    insert into chart_detail values (120,'2011-05',5714,0);
    insert into chart_detail values (90,'2011-05',24557,1);
    insert into chart_detail values (60,'2011-05',0,4);
    insert into chart_detail values (30,'2011-05',0,0);
    COMMIT;EXPECTED RESULTS:
         2011-04                    2011-05               
    DIS     RPLC     BLD     TBLD     IPTV     RPLC     BLD     TBLD     IPTV
    30     1     0     37021     0.03     0     0     30271     0.00
    60     7     0     37021     0.22     4     0     30271     0.13
    90     9     0     37021     0.46     1     24557     30271     0.17
    120     5     26449     37021     0.59     0     5714     5714     0.17
    150     0     10572     10572     0.59               0     
    180               0                    0     
    TOTAL     22     37021               5     30271          PROBLEM: I need to have a running total of IPTV like in the above example. I can get the IPTV for each DIS/bld_mo but I don't know how to get the running total of it. In the script below I just used an example where I tried summing the IPTV like was done for build. I know it can't be done that way because IPTV is a calculated field in the query but if I substitute "APR_IPTV" with the formula for IPTV I get an error that window functions aren't allowed here. I do not know a way around this. I commented out the bad piece of code.
    PROBLEM SCRIPT:
    WITH  pivot_results  AS
      SELECT    dis
      ,    NVL (apr11_rep,  0)  AS apr11_rep
      ,    NVL (apr11_bld,   0)  AS apr11_bld
      ,    NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS apr11_tbld
    ,      DECODE(NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(apr11_rep, 0)*1000/ NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS apr11_iptv               
    ,      NVL ( SUM (apr11_iptv)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS apr11_tiptv  
      ,    NVL (may11_rep,  0)  AS may11_rep
      ,    NVL (may11_bld,   0)  AS may11_bld
      ,    NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS may11_tbld
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_iptv
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_tiptv               
      FROM     chart_detail
      PIVOT     (  MAX (rplc)  AS rep
              ,  MAX (bld)  AS bld
              FOR  bld_mo   IN ( '2011-04'  AS apr11
                                             , '2011-05'  AS may11
    SELECT    CASE
            WHEN  GROUPING (dis) = 0
            THEN  TO_CHAR (dis)
            ELSE  'Total'
        END      AS dis
    ,    SUM (apr11_rep)  AS apr11_rep
    ,    SUM (apr11_bld)  AS apr11_bld
    ,    SUM (apr11_tbld) AS apr11_tbld
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (apr11_iptv)
        END      AS apr11_iptv
    ,    SUM (apr11_tiptv) AS apr11_tiptv
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (apr11_tpiptv)
        END      AS apr11_tiptv
    ,    SUM (may11_rep)  AS may11_rep
    ,    SUM (may11_bld)  AS may11_bld
    ,    SUM (may11_tbld) AS may11_tbld
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (may11_iptv)
        END      AS may11_iptv   
    FROM    pivot_results
    GROUP BY  ROLLUP (dis)
    ORDER BY  pivot_results.dis
    ;Thank you,

    Hi,
    So you know how to compute iptv for an individual row; the problem now is that you want to get a running total of iptv; is that it?
    The problem there is that computing iptv requires an analytic function, and analytic functions can't be nested. To get the results of nesting f (g (x)), where f and g are analytic funtions, you have to compute g in a sub-query, and then use the results as the argument to f in a super-query.
    Here's how to apply that to your situation:
    WITH  pivot_results  AS
         SELECT    dis
    -- April, 2011
           ,           NVL (apr11_rep,   0)  AS apr11_rep
           ,           NVL (apr11_bld,   0)  AS apr11_bld
           ,           NVL ( SUM (apr11_bld)
                                       OVER (ORDER BY dis DESC)
                          , 0
                          )               AS apr11_tbld
         ,      NVL ( 1000 * apr11_rep
                              / NULLIF ( SUM (apr11_bld) OVER (ORDER BY dis DESC)
                                          , 0
                   , 0
                   )               AS apr11_iptv
    -- May, 2011
           ,           NVL (may11_rep,   0)  AS may11_rep
           ,           NVL (may11_bld,   0)  AS may11_bld
           ,           NVL ( SUM (may11_bld)
                                       OVER (ORDER BY dis DESC)
                          , 0
                          )               AS may11_tbld
         ,      NVL ( 1000 * may11_rep
                              / NULLIF ( SUM (may11_bld) OVER (ORDER BY dis DESC)
                                          , 0
                   , 0
                   )               AS may11_iptv
           FROM     chart_detail
           PIVOT    (    MAX (rplc)  AS rep
                    ,    MAX (bld)   AS bld
                    FOR  bld_mo   IN ( '2011-04'  AS apr11
                                      , '2011-05'  AS may11
    SELECT    CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  TO_CHAR (dis)
                  ELSE  'Total'
               END      AS dis
    -- April 2011
    ,           SUM (apr11_rep)  AS apr11_rep
    ,           SUM (apr11_bld)  AS apr11_bld
    ,           SUM (apr11_tbld) AS apr11_tbld
    ,           CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  ROUND ( SUM (SUM (apr11_iptv))
                                          OVER (ORDER BY  dis)
                      , 2
               END      AS apr11_iptv
    -- May 2011
    ,           SUM (may11_rep)  AS may11_rep
    ,           SUM (may11_bld)  AS may11_bld
    ,           SUM (may11_tbld) AS may11_tbld
    ,           CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  ROUND ( SUM (SUM (may11_iptv))
                                          OVER (ORDER BY  dis)
                      , 2
               END      AS may11_iptv
    FROM      pivot_results
    GROUP BY  ROLLUP (dis)
    ORDER BY  pivot_results.dis
    ;Output:
          APR11  APR11   APR11  APR11 MAY11  MAY11   MAY11  MAY11
    DIS    _REP   _BLD   _TBLD  _IPTV  _REP   _BLD   _TBLD  _IPTV
    30        1      0   37021    .03     0      0   30271    .00
    60        7      0   37021    .22     4      0   30271    .13
    90        9      0   37021    .46     1  24557   30271    .17
    120       5  26449   37021    .59     0   5714    5714    .17
    150       0  10572   10572    .59     0      0       0    .17
    Total    22  37021  158656            5  30271   96527As you can see, this is not quite what you wanted on the row where dis='150'. You asked for NULLS in the may11_rep, may11_bld and may11_iptv columns. You can get those results if you need them; just explain the rules that govern whether to display the values and when to display NULL.
    The way you posted the sample data and results, and the quantity of sample data were all excellent; it really helped me find a solution. Thanks.
    It would have also helped it you had explained how iptv is computed. Basically, iptv = 1000 * rep / tbld, right?
    It looks like most of this code:
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_iptvwas a way of avoiding divide by 0 errors; it would have been helpful if you had explained that.

  • Percentage calculation in pivot table per row

    Hello all,
    I do calculate two fields in a pivot table. First calculated field is the # of activities per user (standard SoD reporting field). Second calculated field is the # of activities per user with a certain classification (customized pick list field that is converted in a from a text value to a integer value ==> CASE WHEN Activity.Type = 'Call' THEN 1 ELSE 0 END).
    In the pivot table I do show both vlaues as a sum. I would like to calculate the percentage per row per user.
    Example:
    User - # activities - # calls - percentage
    User XY - 80 - 40 - 50%
    Thanxs for your help
    Elmar

    have you # Call column look like
    sum(CASE WHEN Activity.Type = 'Call' THEN 1 ELSE 0 END) -- column2
    create the percentage column with # activities / column2
    under the column property of the percentage column --> Data Format -->Treat Numbers As --> percentage.
    leave the Aggregation Role as default on all columns.
    Hopefully, I didn't miss anything.
    Shilei

  • Calculated field in a query

    Hi,
    To begin with I am just learning EJB and JAVA so please bear with me. I want to create a calculated field in a query from two fields in the table being queried, using SQL I would write the query like this:
    SELECT ledgerdate, description, quantity, unitprice, [quantity*unitprice] FROM ledger
    I have created a class called ViewLedger to contain my results, it has the following elements:
    DATE ledgerdate,
    STRING description,
    INTEGER quantity,
    BIGDECIMAL unitprice,
    BIGDECIMAL amount
    The query that I have been attempting that fails is:
    SELECT NEW ViewLedger(l.ledgerdate, l.description, l.quantity, l.unitprice, l.quantity*l.unitprice) FROM Ledger l
    The error says that there is an unexpected * in the query
    The following do not work either:
    SELECT NEW ViewLedger(l.ledgerdate, l.description, l.quantity, l.unitprice, (l.quantity*l.unitprice)) FROM Ledger l
    The error says there is an unexpected ( in the query.
    SELECT NEW ViewLedger(l.ledgerdate, l.description, l.quantity, l.unitprice, [l.quantity*l.unitprice]) FROM Ledger l
    The error says there is an unexpected [ in the query.
    Any help would be greatly appreciated.
    Thanks.

    I don't think JPQL allows functions (*) in the SELECT clause.
    You can use a native SQL query as a workaround. If you are using EclipseLink or TopLink Essentials, you can also use a ReportQuery.
    You may also want to vote for the bug,
    [https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814|https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814]
    James : [http://www.eclipselink.org|http://www.eclipselink.org]

  • Statements in calculation fields

    Can you use sql statements in calculated fields, for instance can you use a statement like IF(GL_SEGMENT-04='401000'TO'409999'THEN SUM(GL_BALANCE_PERIOD_BAL_DB-GL_BALANCE_PERIOD_BAL_CR)
    I would think that you could use statements within calculated fields but I am having no luck.
    Thanks in advance

    You are so close, I guess. An alternative syntax you may try:
    SUM(CASE WHEN SEGMENT3 BETWEEN '401010' AND '405999' THEN PERIOD_NET_DR-PERIOD_NET_CR ELSE 0 END)
    You may get error message for not using table prefix. In that case, use the table prefix with each field. As you have seen, Discoverer takes care of the prefix when it first executes the formula. Regarding 0 balance, make sure that the sum is not zero for that range. You may also try with a bigger range. Good luck!

  • Date VS Date Time in Calculated Field

    I have a property for a patients records called Date of Birth. On the table defining it I saved it as a "date" type and It displays only
    the date on the screen as I would like. For some reason though when I needed a calculated field in the Medication record I added a property to the patient records table that concatenated two fields BirthDate and the Age. I used the following code and then
    added an other screen data item on the medication screen to pull the DoBA property up but got a Date/Time instead of just a Date.
    partial void DoBA_Compute(ref string result)
    // Set result to the desired field value
    result = "DoB:" + BirthDate + " Age:" + Age;
    //This is for the property "Date of Birth and Age"
    //I also used the following code to calculate "Age"
    partial void Age_Compute(ref int result)
    // Set result to the desired field value
    int age = DateTime.Now.Year - BirthDate.Year;
    if (BirthDate > DateTime.Now.AddYears(-age)) age--;
    result = age;
    Images

    I'm using cast instead of Convert.ToInt because the last round to value to upper int if value > 0.5 or to lower if value < 0.5 ( I don't remember now if equal goes to < or > ... read function doc ) while Cast to int do not round the value.
    In my code the day of the birthday
    still
    marks
    the
    previous
    age,
    from the
    day after
    one more year.
    by adding
    +
    1
    age
    increases
    by the
    day
    of the birthday

  • To read a calculated field of an MDM record

    Hi All,
    We have a main table in MDM repository with a calculated field and other fields.
    On entering the values of other fields in the table an ID gets generated for the calculated field of that main table.
    Now we want to retrieve that calculated field Id.Can anyone provide pointers for the same?
    Regards,
    Richa

    Hi Richa,
    To retreive calculated field you can use RefreshCalculatedFieldsCommand
                      ResultDefinition resDef = new ResultDefinition(schema.getTableId("TableId"));
                      resDef.addSelectField((FieldId)fieldId.get("fieldId"));
                        RetrieveRecordsByIdCommand varCmd = new RetrieveRecordsByIdCommand(wdContext.currentContextElement().getVa_ConnectionStr());
                        varCmd.addId(VarRecord.getId());
                        varCmd.setSession(wdContext.currentContextElement().getVa_SessionId());
                        varCmd.setResultDefinition(resDef);
                        varCmd.execute();
                        RecordResultSet recResSet = varCmd.getRecords();
                        Record resRecord = recResSet.getRecord(0);
                        wdControllerAPI.getMessageManager().reportWarning("functionsave:SaveVarietyData( )*********07"+resRecord.toString());          
                        MdmValue varCreated = resRecord.getFieldValue((FieldId)fieldId.get("Variety_Material_Number_Inter"));
                        String varCreatedVal = varCreated.toString();
                      Integer varNumCreated = new Integer(varCreatedVal);
                      int varietyValue = varNumCreated.intValue();
                      wdContext.currentContextElement().setVa_GeneratedVarietyId(varietyValue);

Maybe you are looking for

  • Open Interface for OM to Contracts in R12

    Hi, I am facing an issue regarding with OM to Contracts interface, in R12 Warranty contracts are created with standard coverage and having no line for coverage in table OKC_K_LINES_B. Can anyone let me know how we can insert the actaul coverage line

  • Sub-contracting issue

    Hi All, I have created a SC PO, issued componenets to SC vendor (541), howerver while creating GR for final product, i am getting an error for components (543) "Material xyz do not have enough stock " , but it is there in vendor stock. Thanks in adva

  • WLC 5508: 802.1 AAA override; Authenication success no dynamic vlan assignment

    WLC 5508: software version 7.0.98.0 Windows 7 Client Radius Server:  Fedora Core 13 / Freeradius with LDAP storage backend I have followed the guide at http://www.cisco.com/en/US/tech/tk722/tk809/technologies_configuration_example09186a008076317c.sht

  • How to show sysdate in report header

    Hi everyone i want to show the Sysdate option in my report header. i have been looking around and i found out that i have to add {$SYSDATE()$} to my report default value, the issue is 1) cant find where is my default value so i can edit it 2) is ther

  • RDA: Error in Source System

    Hi all, We are using RDA to load data from our SAP CRM into BW via real time datasources. After some time we encountered the following problem: If the source system goes down for a short period, the PSA request turns red (which is ok because there is