Aggregation of results based on rows

Hi All,
We are on BI 7 and are seeing the following issue on one of our queries. In the rows, we have gl account and fiscal period. The column is a restricted key figure which has an amount and is restricted on a fiscal year period range (01/2008 - 03/2008). When I run the query as is I get the correct results out of the cube:
account            fiscal period               amount
10000000          01/2008                     $500
10000000          02/2008                     $1
10000000          03/2008                     $99
Result                                               $600
When I take the fiscal year period out of the rows, it is only showing the last value in the row even though the key figure is still restrict to pull the range of months.
account                   amount
10000000                $99
Desired result is
account                    amount
10000000                  $600
Can anyone please provide a suggestion.
Thanks!

check the calculation tab of the properties windows. the "calculate result as" should be set to Total.

Similar Messages

  • Two column results based on one column

    Tool#
    Time
    102
    12
    104
    5
    108
    0
    111
    5
    112
    8
    114
    0
    117
    0
    120
    0
    125
    15
    189
    7
    I have a table like this in numbers where the time is updated using the formula;
    =SUM((IF($N$4="Y",SUMIF($A$5:$A$13,"=102",$B$5:$B$13),"0"),IF($N$5="Y",SUMIF($D$ 5:$D$13,"=102",$E$5:$E$13), "0"), .... etc.
    The tables that the SUMIF's are referring to are set and constant with times for each tool based on a specific job number. The table with the TRUE or FALSE (ie. Y or N) is where the input is put in order to get the times for each tool from the constant tables and the employee will put in either Y or N.
    What I want to do is create another table from the one above where I can eliminate the tools that have "0" time, but still follow the exact same format (ie. still shows both "Tool#" and "Time" in two seperate columns). How do I do this? How can I have a table where it only gives results based on the second column, but returns both the first and second columns?
    Hope this all makes sense. If you need further information to help me just ask and I can post more about the specifics.

    FE,
    Have you considered using the Row Filter in the Reorganize Panel? Since your hours are calculated it should work well for you.
    Jerry

  • View results in more ROW then Select.

    Hello,
    I am trying to create a view and for some reason when I just run the select statement of that view, i get 11 rows. But when i create the view, i get 106 rows.
    I am really stomped and need to know what's causing this.
    -----------------------------When i execute this view, i get 106 rows -----------------------
    CREATE OR REPLACE VIEW REGRPT_CONS_SPECIAL_FEE_VIEW
    (REG_CONFERENCE_ID, COMPANY, CONF_REFERENCE_CODE, CONF_DESCRIPTION, REG_SESSION_ID,
    SESS_REFERENCE_CODE, BEGIN_DATE, END_DATE, SESS_DESCRIPTION, CONSULTANT_ID,
    SPECIAL_FEE_AMOUNT, REASON, REGISTERED)
    AS
    SELECT DISTINCT RCC.REG_CONFERENCE_ID
         , RCC.COMPANY
         , RC.REFERENCE_CODE
         , RCT.DESCRIPTION
         , RS.ID
         , RS.REFERENCE_CODE
         , RS.BEGIN_DATE
         , RS.END_DATE
         , RST.non_html_DESCRIPTION
         , rsf.consultant_no
         , rsf.fee_amount
         , rsf.reason
         , 'Y'
    FROM reg_conference_company@webtst rcc
         , reg_conference@webtst rc
         , reg_conference_type@webtst rct
         , reg_session@webtst rs
         , reg_session_t@webtst rst
         , locale@webtst l
         , reg_special_fee@webtst rsf
         , reg_consultant@webtst rcons
    WHERE rcc.reg_conference_id = rc.ID
    AND rc.reg_conference_type_id = rct.ID
    AND RC.ID = RS.REG_CONFERENCE_ID
    AND rs.ID = rst.reg_session_id
    AND rst.locale_id = l.ID
    AND l.language_id = '1'
    AND L.COMPANY = RCC.COMPANY
    AND rc.ID = rsf.reg_conference_id
    AND rcc.company = rsf.company
    AND rs.ID = rcons.reg_session_id
    AND rsf.company = rcons.company
    AND rsf.consultant_no = rcons.consultant_no
    AND rcons.status <> 'C'
    UNION
    --- consultants not registered and in special fee
    SELECT DISTINCT RCC.REG_CONFERENCE_ID
         , RCC.COMPANY
         , RC.REFERENCE_CODE
         , RCT.DESCRIPTION
         , RS.ID
         , RS.REFERENCE_CODE
         , RS.BEGIN_DATE
         , RS.END_DATE
         , RST.non_html_DESCRIPTION
         , rsf.consultant_no
         , rsf.fee_amount
         , rsf.reason
         , 'N'
    FROM reg_conference_company@webtst rcc
    , reg_conference@webtst rc
    , reg_conference_type@webtst rct
    , reg_session@webtst rs
    , reg_session_t@webtst rst
    , locale@webtst l
    , reg_special_fee@webtst rsf
    WHERE rcc.reg_conference_id = rc.ID
    AND rc.reg_conference_type_id = rct.ID
    AND RC.ID = RS.REG_CONFERENCE_ID
    AND rs.ID = rst.reg_session_id
    AND rst.locale_id = l.ID
    AND l.language_id = '1'
    AND L.COMPANY = RCC.COMPANY
    AND rc.ID = rsf.reg_conference_id
    AND rcc.company = rsf.company
    AND (rsf.company || rsf.consultant_no) NOT IN
                                  (SELECT (company ||consultant_no)
                                  FROM reg_consultant@webtst
                                  WHERE status <> 'C'
                                  AND reg_session_id = rs.ID)
    --------------When i run this select i get 11 rows ----------------------------
    SELECT DISTINCT RCC.REG_CONFERENCE_ID
         , RCC.COMPANY
         , RC.REFERENCE_CODE
         , RCT.DESCRIPTION
         , RS.ID
         , RS.REFERENCE_CODE
         , RS.BEGIN_DATE
         , RS.END_DATE
         , RST.non_html_DESCRIPTION
         , rsf.consultant_no
         , rsf.fee_amount
         , rsf.reason
         , 'Y'
    FROM reg_conference_company@webtst rcc
         , reg_conference@webtst rc
         , reg_conference_type@webtst rct
         , reg_session@webtst rs
         , reg_session_t@webtst rst
         , locale@webtst l
         , reg_special_fee@webtst rsf
         , reg_consultant@webtst rcons
    WHERE rcc.reg_conference_id = rc.ID
    AND rc.reg_conference_type_id = rct.ID
    AND RC.ID = RS.REG_CONFERENCE_ID
    AND rs.ID = rst.reg_session_id
    AND rst.locale_id = l.ID
    AND l.language_id = '1'
    AND L.COMPANY = RCC.COMPANY
    AND rc.ID = rsf.reg_conference_id
    AND rcc.company = rsf.company
    AND rs.ID = rcons.reg_session_id
    AND rsf.company = rcons.company
    AND rsf.consultant_no = rcons.consultant_no
    AND rcons.status <> 'C'
    UNION
    --- consultants not registered and in special fee
    SELECT DISTINCT RCC.REG_CONFERENCE_ID
         , RCC.COMPANY
         , RC.REFERENCE_CODE
         , RCT.DESCRIPTION
         , RS.ID
         , RS.REFERENCE_CODE
         , RS.BEGIN_DATE
         , RS.END_DATE
         , RST.non_html_DESCRIPTION
         , rsf.consultant_no
         , rsf.fee_amount
         , rsf.reason
         , 'N'
    FROM reg_conference_company@webtst rcc
    , reg_conference@webtst rc
    , reg_conference_type@webtst rct
    , reg_session@webtst rs
    , reg_session_t@webtst rst
    , locale@webtst l
    , reg_special_fee@webtst rsf
    WHERE rcc.reg_conference_id = rc.ID
    AND rc.reg_conference_type_id = rct.ID
    AND RC.ID = RS.REG_CONFERENCE_ID
    AND rs.ID = rst.reg_session_id
    AND rst.locale_id = l.ID
    AND l.language_id = '1'
    AND L.COMPANY = RCC.COMPANY
    AND rc.ID = rsf.reg_conference_id
    AND rcc.company = rsf.company
    AND (rsf.company || rsf.consultant_no) NOT IN
                                  (SELECT (company ||consultant_no)
                                  FROM reg_consultant@webtst
                                  WHERE status <> 'C'
                                  AND reg_session_id = rs.ID)

    I don't know the reason, but here is what I would do to narrow the search for it.
    Remove all DISTINCT operators and replace UNION with UNION ALL. Compare the result (number of rows) for the select and for the View.
    If it is the same, then you have some problem with duplicate values. If not you have two different selects (compare execution plan too) or different data (does it run in the same schema?).
    Then add step by step a DISTINCT and check how the result changes. Start analyzing only this part of the query.

  • How do I create a 1d array that takes a single calculation and insert the result into the first row and then the next calculation the next time the loop passes that point and puts the results in thsecond row and so on until the loop is exited.

    The attached file is work inprogress, with some dummy data sp that I can test it out without having to connect to equipment.
    The second tab is the one that I am having the problem with. the output array from the replace element appears to be starting at the index position of 1 rather than 0 but that is ok it is still show that the new data is placed in incrementing element locations. However the main array that I am trying to build that is suppose to take each new calculation and place it in the next index(row) does not ap
    pear to be working or at least I am not getting any indication on the inidcator.
    Basically what I am attempting to do is is gather some pulses from adevice for a minute, place the results for a calculation, so that it displays then do the same again the next minute, but put these result in the next row and so on until the specifiied time has expired and the loop exits. I need to have all results displayed and keep building the array(display until, the end of the test)Eventually I will have to include a min max section that displays the min and max values calculated, but that should be easy with the min max function.Actually I thought this should have been easy but, I gues I can not see the forest through the trees. Can any one help to slear this up for me.
    Attachments:
    regulation_tester_7_loops.vi ‏244 KB

    I didn't really have time to dig in and understand your program in depth,
    but I have a few tips for you that might things a bit easier:
    - You use local variables excessively which really complicates things. Try
    not to use them and it will make your life easier.
    - If you flowchart the design (very similar to a dataflow diagram, keep in
    mind!) you want to gather data, calculate a value from that data, store the
    calculation in an array, and loop while the time is in a certain range. So
    theres really not much need for a sequence as long as you get rid of the
    local variables (sequences also complicate things)
    - You loop again if timepassed+1 is still less than some constant. Rather
    than messing with locals it seems so much easier to use a shiftregister (if
    absolutely necessary) or in this case base it upon the number of iterations
    of the loop. In this case it looks like "time passed" is the same thing as
    the number of loop iterations, but I didn't check closely. There's an i
    terminal in your whileloop to read for the number of iterations.
    - After having simplified your design by eliminating unnecessary sequence
    and local variables, you should be able to draw out the labview diagram.
    Don't try to use the "insert into array" vis since theres no need. Each
    iteration of your loop calculates a number which goes into the next position
    of the array right? Pass your result outside the loop, and enable indexing
    on the terminal so Labview automatically generates the array for you. If
    your calculation is a function of previous data, then use a shift register
    to keep previous values around.
    I wish you luck. Post again if you have any questions. Without a more
    detailed understanding of your task at hand it's kind of hard to post actual
    code suggestions for you.
    -joey
    "nelsons" wrote in message
    news:[email protected]...
    > how do I create a 1d array that takes a single calculation and insert
    > the result into the first row and then the next calculation the next
    > time the loop passes that point and puts the results in thsecond row
    > and so on until the loop is exited.
    >
    > The attached file is work inprogress, with some dummy data sp that I
    > can test it out without having to connect to equipment.
    > The second tab is the one that I am having the problem with. the
    > output array from the replace element appears to be starting at the
    > index position of 1 rather than 0 but that is ok it is still show that
    > the new data is placed in incrementing element locations. However the
    > main array that I am trying to build that is suppose to take each new
    > calculation and place it in the next index(row) does not appear to be
    > working or at least I am not getting any indication on the inidcator.
    >
    > Basically what I am attempting to do is is gather some pulses from
    > adevice for a minute, place the results for a calculation, so that it
    > displays then do the same again the next minute, but put these result
    > in the next row and so on until the specifiied time has expired and
    > the loop exits. I need to have all results displayed and keep building
    > the array(display until, the end of the test)Eventually I will have to
    > include a min max section that displays the min and max values
    > calculated, but that should be easy with the min max function.Actually
    > I thought this should have been easy but, I gues I can not see the
    > forest through the trees. Can any one help to slear this up for me.

  • Formulas results outside of row and column axis

    The report has an area of row axis and column axis. This area is where the results from BW are displayed.
    We have a requirement where we would have to create formulas using the BW Analyzer results of the row axis and column axis and display the results after the last row of this area.
    For example, after the BW Analyzer displays the result area to the Excel, we are required to take Excel Cell D10 * C7 and put the results to B33.
    <b>B33 = D10*C11</b>
    Excel row 30 is the last row from the row axis result area.
    I have searched through the forum for Cell Editor, but it seems that the requirement is to use 2 structures and use Cell Editor only when there is a formula collision. Our requirement has 1 structure, but I guess we can create the other structure for the column axis results. But still I think Cell Editor is a computation of formula collision within the row and column axis result area.
    My question is will Cell Editor meet our requirement if we want to get formula results from the row and column axis and then display the results outside of the row and column axis result area?
    Our approach was to use the Excel cell formulas in the workbook or possibly macros, but it seems that the Excel formulas will do.
    Would someone clarify about the Cell editor for this requirement and how would you approach this?
    Would this be effective to do the formulas from the query level? We are working on 3.5 SP11.

    Can Cell editor do the following:
    1. Create structures
    2. Run the query
    3. The results of the structures are displayed in the row and column axis of the BEx Analyzer
    4. Save as a workbook
    5. Use the Cell Editor to pick and choose the cells (Not the Excel cells) to create formulas
    6. The formula results are then displayed outside of the row and column axis.
    Would this be another approach?
    What scenario can Cell editor be used? What scenario can Cell editor not be used?
    Thanks

  • Query for a value result when no rows found

    Kindly help me out when I use following query it return no record but I want 0 against this query how plz let me know
    select b.accode,decode(sum(b.debit),null,0,sum(b.debit)) op_dr,
    decode(sum(b.credit),null,0,sum(b.credit)) op_cr,
    c.actitle
    from v_mast a, v_det b, chart c
    where a.v_type=b.v_type
    and a.vouchno=b.vouchno
    and b.accode=c.accode
    and a.VOID='F'
    and a.posted_by is not null
    and a.v_date between '01-JAN-06' and '31-JAN-06'
    and b.accode in (select accode from account where open='T')
    and b.accode in (select accode from chart)
    and a.v_type in ('RN','PV','CV','RV','JV')
    and b.accode = '3050571'
    group by b.accode,c.actitle
    order by b.accode
    Result is : No rows found but is there any possibilities that it will give me following result
    Accode op_dr op_cr
    3050571 0 0

    Why not respond to the earlier threads ?
    Query
    and
    0 when no records found
    Regards,
    Rob.
    Message was edited by:
    Rob van Wijk
    PS: Of course you could do a
    <your query> union all select 3050571,0,0,null from dual
    It answers the question, but I doubt that this is what you want.

  • Creating result based search programatically

    Hi All,
    I am trying to create a simple result based search programmatically. I need to do this because I want the user to basically be able to select a specific table name and then the search adjusts the criteria and results automatically based on the table selected. If you like it is a generic query mechanism.
    I have attempted to do this by declaratively setting up the query region as far as possible and then adding the table fields and binding them to a VO instance that I have created (I also create the view definition programatically)
    The query region renders and the go and clear buttons are available, the result table renders and if I do a blind query it works fine and the result appear. The problem I have is that for the fields in the table that have queriable set to yes, the search region is not rendering the search fields.
    This is what I have done (all in process request for now to get it working)
    OADBTransactionImpl dbTx = (OADBTransactionImpl)am.getTransaction();
    OAViewDef viewDef = dbTx.createViewDef();
    viewDef.setViewObjectClass("oracle.apps.fnd.framework.server.OAViewObjectImpl");
    viewDef.setViewRowClass("oracle.apps.fnd.framework.server.OAViewRowImpl");
    viewDef.addSqlDerivedAttrDef("RECORD_ID","RECORD_ID","java.lang.String",Types.VARCHAR,false,true,AttributeDef.READONLY);
    viewDef.addSqlDerivedAttrDef("RUNTIME_KEY","RUNTIME_KEY","java.lang.String",Types.VARCHAR,false,true,AttributeDef.READONLY);
    viewDef.addSqlDerivedAttrDef("STATUS","STATUS","java.lang.String",Types.VARCHAR,false,true,AttributeDef.READONLY);
    viewDef.setSql(sqlStmt);
    am.createViewObject("InterfaceTableVO1",viewDef);
    OATableBean tableBean = (OATableBean)webBean.findChildRecursive("InterfaceTableVO1");
    OAMessageStyledTextBean leaf = null;
    leaf=(OAMessageStyledTextBean)createWebBean(pageContext,MESSAGE_STYLED_TEXT_BEAN,null,"RECORD_ID");
    leaf.setViewUsageName("InterfaceTableVO1");
    leaf.setViewAttributeName("RECORD_ID");
    leaf.setWrapEnabled(false);
    leaf.setPrompt("RECORD_ID");
    leaf.setQueryable(true);
    tableBean.addIndexedChild(leaf);
    The query bean and table have been defined declaratively, my hope was when I added the leaf nodes to the table with query able set to true that the framework would automatically figure the bindings out but it doesn't seem to be doing this.
    Could this be a UIX rendering problem that I need to get around somehow?
    Thanks
    Keith

    anyone got any ideas on this one?

  • Aggregation On Value Based Hierarchy

    Hi
    I am having a problem with aggregation on value based hierarchy
    Well I have a table which will serve as my fact and dimension table
    It is as follows
    ID     Name     MID     Salary
    0     All          
    1     A     0     10000
    2     B     1     9000
    3     C     1     9000
    4     D     1     9000
    5     E     2     8000
    6     F     2     8000
    I created a value based dimension named EMPLOYEE , with child as ID and parent as MID
    I created a cube EMP_SALARY with a measure salary mapped to the Salary column in Employee
    My expectation here is to see the total salary at every level including the salary at that level
    So let us take employee B as an example. He is the manager for employees E and F
    So what I would like to see at level B is sal of B + sal of E + Sal of F = 9000 + 8000 + 8000 = 25000
    But what I get from the cube is 9000. Now is the above possible ? If so please so provide me suggestions
    I can achieve the same by using the following sql query
    select e1.id,rpad('*',2*level,'*') || e1.name,e1.sal,
    select sum(e2.sal)
    from test_emp e2
    start WITH e2.id = e1.id
    CONNECT by PRIOR e2.id = e2.mid
    ) sum_sal
    from test_emp e1
    start with e1.mid is null
    CONNECT by prior e1.id = e1.mid;

    The same basic problem, along with a solution, was discussed in the following thread.
    Re: Value Based Dimension causing Aggrega                         tion problems

  • Result in same row instead of two rows

    I have to select same field on two different condition ie.
    select
    (case when data_type_id = 1 then hrscycles else 0 end) totalhours
    ,(case when data_type_id = 10 then hrscycles else 0 end) totalcycles
    from mytable
    Problem is query is returning 2 rows whereas i want result in single row.Is there any other solution?

    select (case when data_type_id = 1 then hrscycles else 0 end) totalhours,
    (case when data_type_id = 10 then hrscycles else 0 end) totalcycles
    from mytableyour query in the above will return two columns and will return multiple rows depending on the data your table have.
    maybe you want single column?
      select (case when data_type_id = 1 then hrscycles
                   else 0
              end) attribute1
        from mytable
      union all
      select (case when data_type_id = 10 then hrscycles
                   else 0
              end) attribute1
      from mytableor if you want a multiple rows into a single column:
    SQL> select * from pivot_tab;
          COL1 COL2
             1 a
             1 b
             1 c
             2 h
             2 h
    SQL> select p.col1,
      2         substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
      3         as col2
      4    from (select col1,
      5                 col2,
      6                 row_number() over (partition by col1 order by col1, col2) rn
      7            from pivot_tab) p
      8  start with p.rn = 1
      9  connect by p.rn = prior p.rn + 1
    10  and prior p.col1 = p.col1
    11  group by col1;
          COL1 COL2
             1 a,b,c
             2 h,h
    SQL>

  • Collection Element Result based on multiple collection element values

    Dear All,
    we want to drive a result in the collection element "Result" based on two other elements on collection plan
    For examples,
    Collection Element: "Feathering" , "Ink upTime" and "Result"
    Feathering Acceptable range 2-6 mm
    Ink upTime Acceptable range 2-6 minutes
    Result have a valid values " Accept " and " Reject "
    Feathering=3 ( withing the limit)
    Ink Uptime=8 ( Outside the limit)
    so the Result= Reject
    on collection plan
    Please help me to resolve this scenerio ASAP.
    Regards,
    Edited by: Yasir_Oracle on Jun 11, 2011 2:08 PM

    Hi Pankaj ,
    Thank You for your response. But I have one observation for your given solution and this I have tried myself
    For example
    1) Define an action on "Feathering" element as:
    Condition:
    Value outside of specification limits.
    Action :
    Assign a value to collection element "Result" = "Reject".
    2) Define an action on "Ink up Time" element as:
    Condition:
    Value Within the specification limits.
    Action :
    Assign a value to collection element "Result" = "Accept".
    3) The final value of "Result" = "Accept" , because last element "Ink Up Time" within the spec. limit due to which "Result" populated with the value "Accept".
    But this is not the case what I want the value of "Result" element assign when all element are within the specification limit, in the above case "Result" should by Reject.
    Regards,
    Yasir

  • Create URL,Telephone number as paramater Account Search and result based on parameter of telephone number ?

    Hi Experts,
    create URL,Telephone number as paramater Account Search and result based on parameter of telephone number ?..
    Previous my thread was locked...Now i want to say thanks to KALYANI L and Richa Dameja,..Now This code i have followed now its working fine..Thanks Great help to Kalyani L..and Richa Dameja.. i have implemented the DO_INIT_CONTEXT.....Now getting result...
    As suggest Kalyani L i have implemented DO_INTI_CONTEXT method,Now its working fine....
    Thanks For support.
    Thanks
    kalpana
    Message was edited by: Andrei Vishnevsky
    Disussion is locked.
    Reason: Re: create URL,Telephone number as paramater Account Search and result based on parameter of telephone number ?

    Hello Kalpana,
    I've already locked your previous discussion and thought that I gave pretty clear warning.
    First of all "do my job" posts are not welcomed on SCN.
    Second point: you're incorrect in choosing SCN space with such questions. Here is a little which is related to IC in your task.
    Third point is that if somebody has an answer to your exact question then he will give you it if he wants. There is no reason to post-post-post messages asking for help or hurry. Your "urgent requirement" is not the reason either.
    Fourth one is: according to The SCN Rules of Engagement you need to do the search before posting. Almost all of your questions regarding this topic has an answer already.
    Locking the discussion again. If you continue to post such questions I will need to report this situation to SAP CRM space editors and global moderators.

  • Search Results based on other Search Results

    Scenario -
    I have a BDC content type which has a custom page for end users to view the data in the content type.  This page has a search result we part that displays the details of the content type.  There are other search result web parts that show related
    documents to the content type. 
    We are able to use the query string to pass in properties of the content type that will filter the search results to documents based on the passed value.  Example: Employee content type has custom page that lists the details about that employee, and
    when passing the department in the url to the page, a list of department specific documents can be displayed.
    There are several attributes of the "Employee" content type that we would like to filter for specific documents with.  How can I access these attributes with out passing them through the query string in the url? 
    I would rather not have to pass all these elements in the url Employee.aspx?employeeid={0}&department={1}&state={2}&employeetype={3} ect...  I would be better to just pass the employee id, and the page be able to get all the information
    it needs for the Search Results/Content Search web parts.
    Any thoughts would be helpful.  We are currently looking at the Product Catalog items, but this doesn't seem to fix our issue where we need to filter the results based on attributes of the current contextual content type.
    Thank You
    Shane

    I have been doing some more research, and I just cannot seem to find a viable option.  Can I use the Page.<FieldName>, or ListItem.<property>?  I am not sure, and no body seems to be doing anything like this?  Can it be done with
    javascript on the client, without having to rebuild the Display Template functionality for the results?
    So many questions and no one seems to have an answer?
    Shane

  • Filtering results based on dynamic date in coldfusion and access database

    Hello Guys, i am using a cfquery and am trying to return results based on date. the idea is to return entries that are less than or equal to date but am not getting any results but when i change to greater than or equal to i get the all results in databse which is wrong.
    Below is my code. is there something am doing wrong? Please help.
    <cffunction name="getBal" access="remote">
    <cfargument name="ID_biodata" type="string" required="true">
            <cfargument name="quater" type="string" required="true"/>
            <cfargument name="datePaid" type="date" required="true"/>
            <cfquery name="qBal" datasource="bond100">
    SELECT ID_biodata, quater, datePaid, amountPaid, manFees
    FROM collections
    WHERE datePaid <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#parseDateTime(arguments.datePaid)#">
                AND ID_biodata = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.ID_biodata#">
                AND quater = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.quater#">
                ORDER BY datePaid
    </cfquery>
            <cfquery dbtype="query" name="results">
            SELECT SUM(CAST(amountPaid as INTEGER) + CAST(manFees as INTEGER)) AS totalPaid
                FROM qBal           
            </cfquery> 
            <cfreturn results />
        </cffunction>

    Turn on debugging so that you can see what ColdFusion is sending to your database server.
    The debug info will show the SQL statement with query parameter values below it.
    Cheers
    Eddie

  • How can I query a table based on row numbers?

    select numberofmonths  from traveldays_president where row_number= 55;
    How can I go about filtering records based on row number?

    Use a query like
    select numberofmonths from traveldays_president where row_number=@rownumber
    Create a dataset with above query in SSRS and on refreshing it after execution SSRS will add field information and parameter information for you. Then when you try to run report it will ask you for value of rownumber and based on value you pass it will give
    you corresponding row(s) in output
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Problems with splitting result into different rows. Group by-issue?

    Hi all!
    I have a table that looks a bit like this:
    Pallet          Status          Number          Time
    A          MoveIn          48          11:11
    A          Pick          -1          11:11
    A          Pick          -1          11:12
    A          Pick          -1          11:12
    A          MoveOut     45          11:13
    A          MoveIn          45          18:20
    A          Pick          -1          18:23
    A          Pick          -1          18:23
    A          Pick          -1          18:23
    A          Pick          -1          18:24
    A          MoveOut     41          18:25
    A          MoveIn          41          21:31
    A          Pick          -1          21:55
    .....This is logging pallets that is moved to one station and then number of boxes are picked off. (For making it more simple, I only show one pallet in above example.)
    I would like to present the result with one row for each time the pallet have been at the station, like:
    Pallet          Picked          Time
    A          3          11:11
    A          5          18:20
    A          ....          .....This means that the same pallet might be showned on several rows, as it has been to the station several times. I have tried several different "GROUP BY" but I cannot make it work.
    For example I have tried to group by hour, but this fails if a pallet is moved twice per hour or if boxes are picket at different hours (eg, first box picked 09:59, last box 10:01)
    Does anyone have a suggestion how to solve this?
    Thanks in advance and Kind regards / Anders from Sweden

    Hej, Anders,
    Can you explain what defines a group?
    It looks like you're saying that a group is a sub-set of a pallet. If we arrange all the rows for a pallet in order by time, then a new group will start every time we have a row where status='MoveIn'. That is, a group consists of a row with status='MoveIn', and all the rows immediately following it, in order by time, up to, but not including, the next row with status=-'MoveIn'. Is that right?
    If so, you can use the analytic COUNT (or SUM) function to find out how many rows with status='MoveIn' have already occurred, in order by time, like this:
    WITH     got_grp          AS
         SELECT     pallet, status, time
         ,     COUNT ( CASE
                             WHEN  status = 'MoveIn'
                       THEN  1
                         END
                    ) OVER ( PARTITION BY  pallet
                                ORDER BY          time
                        )           AS grp
         FROM    table_x
    SELECT       pallet
    ,       COUNT ( CASE
                      WHEN  status = 'Pick'
                    THEN  1
                  END
                )          AS picked
    ,       MIN (time)          AS start_time
    FROM       got_grp
    GROUP BY  pallet
    ,            grp
    ORDER BY  pallet
    ,            grp
    ;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test this.
    This assumes that the combination (pallet, time) is unique. Your sample data includes:
    Pallet          Status          Number          Time
    A          MoveIn          48          11:11
    A          Pick          -1          11:11I assume that you're just not displaying the full time, and your data is really something like:
    Pallet          Status          Number          Time
    A          MoveIn          48          23-Sep-2011 11:11:01
    A          Pick          -1          23-Sep-2011 11:11:08Otherwise, how do you know if these two rows are in te same group or not? You may need to add a tie-breaker to the analytic ORDER BY clause. For example, if you say "ORDER BY time, *status* ", then, if the two rows above really did have exactly the same time, down to the second, then the one with status='MoveIn' would be considered to be earlier than the row with status='Pick'.

Maybe you are looking for

  • Upgrading from HTC Incredible (3G version) to HTC Rezound, need to transfer ALL data

    Well, what the title says. Can someone please tell me ( in clear, intelligent, unbroken ENGLISH!) how to transfer EVERYTHING from my old phone to the new? Neither phone is <Deleted> or in any way modified, and I don't plan on changing that. So far, I

  • Error Message in Adobe ExportPDF

    When trying to convert a pdf to word, I get this message:  PDF files containing XFA forms cannot be saved to the specified format.

  • I can´t restore my tabs (and I´ve already checked the History-Recently Closed Tabs)

    If, by accident, I click on the bottom part of Firefox (above Windows´ taskbar) the browser sort of minimizes and I can´t reopen it, I have to cancel everything I´m doing. As I usually work with many tabs, a pop-up asks me if I want Firefox to save m

  • Atv buffering (after upgrade)

    We have seen video buffering issues (and long lag time before video starts) with both ATV2 and ATV3, after the Sept 2013 software update. This happens not only with online videos, but also happens with videos stored in IPAD2, and played via AIRPLAY.

  • Only some .MOV files import?

    Hi everyone, I'm having a bit of trouble. I have installed Quicktime to get the .MOV files to import - and it reads them, but only SOME of them. Which is weird. There are 24 .MOV files in total - and 9 of them are showing as audio files only. Any ide