How to group data based on date

In my program the internal table is returning several values based on date.
for example for the first pernr in the image below  there are four records. i need to delete the first record which is between the dates 20 and 30 .
and also i need to get the difference between the dates as the record 23 and 28  i need to get separate dates as 24, 25..28.

I am not sure if I understood your question correctly.
From what I have understood, you can use the following logic.
This logic will move all the records from lt_fields2 to another table lt_fields1 with begda between 20 and 30 of any month, except for the first record. It will also move records for every date between begda and endda of each record.
You can alter the logic based on your exact requirement.
declare another table lt_fields1 like lt_fields2.
data del_flag.
data prev_month(2) type c.
sort lt_fields by pernr begda.
clear del_flag.
loop at lt_fields2 into wa_fields where begda+6(2) GE 20.
* Delete the first record having date greater than 20 in a month for each pernr.
   at new pernr.
        clear del_flag.
   endat.
   if begda+4(2) NE prev_month.
       clear del_flag.
  endif.         
    if del_flag is initial. 
        del_flag = 'X'.
        continue.  " This record will not be moved to the final internal table.
   endif.
* Add records for each date between begda and endda.
   append wa_fields to lt_fields1.
   prev_month = begda+4(2)
   while wa_fields-begda LT wa_fields-endda.
         wa_fields-begda = wa_fields-begda+1.
         append wa_fields to lt_fields1.
   endwhile.
endloop.

Similar Messages

  • Help on how to group data in Answers

    Hi
    I need to group data on the number of times it occurs.
    Below is the source data:
    Table:
    Order No; Product
    1 A
    2 A
    3 A
    4 B
    5 B
    I need to show the above data in the follwoing way:
    Product 1 Occurance <2 Occurance <3 Occurance
    A 0 0 3
    B 0 2 0
    Could you please advise on how best to do this?
    Thanks
    A

    I've created a count column in the logical layer and have tried a count in the presentation services. However I am unable to display the results they way I want them.
    I want to show the number of occurrences under the specific heading, example below
    Product Occ 1 Occ 2 Occ 3
    A 0 0 3
    where do you recommend creating the count and how can I show the count under the specific heading?

  • How to group data and assign cell names using Excel templates

    Hi all,
    reading the article "Real Excel Templates 1.5" on the Tim Dexter's Blog, I found that I need hierarchical data for Excel templates. So only in this way I can group my data.
    My hierarchy is composed by 3 levels:
    lev 1 DESTINATION: is the higher level that groups SERVICES and COUNTRY
    lev 2 SERVICES: is the level that groups the countries
    lev 3 COUNTRY: is the lowest level with the COUNTRY, CALLS and CALLS_MINUTES details
    An example of my hierarchy is this:
    lev 1 INTERNATIONAL
    lev 2 INTERNATIONAL FIXED
    lev 3 Albania 90 438,15
    lev 3 Armenia 1 16,95
    lev 2 INTERNATIONAL MOBILE
    lev 3 Albania Mobile 161 603,35
    lev 3 Australia Mobile 6 34,38
    lev 1 NATIONAL
    lev 2 HELLAS LOCAL
    lev 3 Hellas Local 186,369 707940,6
    lev 2 HELLAS MOBILE
    lev 3 Hellas Mobile Cosmote 31,33 43856,97
    lev 3 Hellas Mobile Q-Telecom 2,398 4343,78
    lev 2 HELLAS NATIONAL
    lev 3 Hellas Long Distance 649 1499,55
    lev 1 INTERNET
    lev 2 INTERNET CALLS
    lev 3 Cosmoline @Free 79 2871,3
    So, my data template is the following (with exactly the hierarchy I want for my data):
    <dataTemplate name="emp" description="destinations" dataSourceRef="GINO_DB">
         <dataQuery>
              <sqlStatement name="Q1">
                   <![CDATA[SELECT 1 TOTAL_CALLS, 2 TOTAL_CALLS_MIN from dual ]]>
              </sqlStatement>
              <sqlStatement name="Q2">
                   <![CDATA[SELECT dest.ID_DESTINATION, dest.DESC_DEST from ale.AAA_DESTINATION dest order by dest.ID_DESTINATION ]]>
              </sqlStatement>
              <sqlStatement name="Q3">
                   <![CDATA[SELECT ser.ID_SERVICE,
    ser.ID_DEST,
    ser.DESC_SERVICE,
    count.ID_COUNTRY,
    count.ID_SERV,
    count.COUNTRY,
    count.CALLS,
    count.CALLS_MIN
    from ale.AAA_SERVICE ser, ale.AAA_COUNTRY count
    where ser.ID_SERVICE= count.ID_SERV
    and ID_DEST = :ID_DESTINATION
    order by ser.ID_SERVICE ]]>
              </sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="G_TOT" source="Q1">
                   <element name="TOTAL_CALLS" value="G_COUNTRY.CALLS" function="SUM()"/>
                   <element name="TOTAL_CALLS_MIN" value="G_COUNTRY.CALLS_MIN" function="SUM()"/>
                   <group name="G_DEST" source="Q2">
                        <element name="DESC_DEST" value="DESC_DEST"/>
                        <element name="DEST_CALLS_SUBTOTAL" value="G_COUNTRY.CALLS" function="SUM()"/>
                        <element name="DEST_CALLS_MIN_SUBTOTAL" value="G_COUNTRY.CALLS_MIN" function="SUM()"/>
                        <group name="G_SERV" source="Q3">
                             <element name="DESC_SERVICE" value="DESC_SERVICE"/>
                             <element name="SERV_CALLS_SUBTOTAL" value="G_COUNTRY.CALLS" function="SUM()"/>
                             <element name="SERV_CALLS_MIN_SUBTOTAL" value="G_COUNTRY.CALLS_MIN" function="SUM()"/>
                             <group name="G_COUNTRY" source="Q3">
                                  <element name="COUNTRY" value="COUNTRY"/>
                                  <element name="CALLS" value="CALLS"/>
                                  <element name="CALLS_MIN" value="CALLS_MIN"/>
                             </group>
                        </group>
                   </group>
              </group>
         </dataStructure>
    </dataTemplate>
    Not considering the CALLS and CALLS_MIN details (I focused only on the COUNTRY which is as the same level), with this data template, making tests on my excel template, I noticed that I can group ONLY two nested levels using the format XDO_GROUP_?group_name?
    XDO_GROUP_?G_DEST?
    XDO_GROUP_?G_SERV?
    or
    XDO_GROUP_?G_DEST?
    XDO_GROUP_?G_COUNTRY?
    or
    XDO_GROUP_?G_SERV?
    XDO_GROUP_?G_COUNTRY
    If I try to group all the three level together in this order
    XDO_GROUP_?G_DEST?
    XDO_GROUP_?G_SERV?
    XDO_GROUP_?G_COUNTRY
    I don't have the output I would like to have.....
    Practically, in my excel I have 3 rows with the following labels
    DESTINATION (called XDO_?DESC_DEST? - =Sheet1!$A$3
    SERVICE (called XDO_?DESC_SERVICE? - =Sheet1!$A$4
    COUNTRY (called XDO_?COUNTRY? - =Sheet1!$A$5)
    where
    XDO_GROUP_?G_DEST? (=Sheet1!$A$3:$B$5)
    XDO_GROUP_?G_SERV? (=Sheet1!$A$4:$B$5)
    XDO_GROUP_?G_COUNTRY     (=Sheet1!$A$5:$B$5)
    I noticed that if I don't use the last one (XDO_GROUP_?G_COUNTRY), my output is correct even if I don't have more than one country for each service....As soon as I put XDO_GROUP_?G_COUNTRY....I loose all the 2nd level and the most of times the 3rd level too....
    So...I think that the problem is how I choose the excel cells when I assign the XDO_GROUP_?group_name?
    Anybody had made some tests, or can help me ???? I'm becoming crazy.....
    Any help will be appreciated
    Thanks in advance
    Alex

    But how can I use tags XDO_GROUP_?? to group data correctly using hierarchial xml, I don't want to use flat XML.
    Yep, I using Template Builder in Excel to run reports localy, and output is wrong
    It's seems that groups couldn't define the level of nesting, I think...
    How can I write it in XDO_METADATA sheet?
    Though I have hierarchial XML and groups should define nesting level correctly.
    I have no clue.....

  • How to group data from two tables ?

    Hello,
    I have two tables and i want to group data from them but two table not linked.
    Table TEXT_IN : ID_IN (primary_key), DATE_IN
    Table TEXT_OUT : ID_OUT(primary_key),DATE_OUT
    Example :
    Result :Group Date and Order by IN,OUT
    And It seems a bit
    confusing because we do not link
    .You can give me solutions.
    Thank you.

    SELECT MAX(CASE WHEN Rn = 1 THEN [IN] END) AS [IN1],
    MAX(CASE WHEN Rn = 1 THEN [OUT] END) AS [OUT1],
    MAX(CASE WHEN Rn = 2 THEN [IN] END) AS [IN2],
    MAX(CASE WHEN Rn = 2 THEN [OUT] END) AS [OUT2],
    MAX(CASE WHEN Rn = 3 THEN [IN] END) AS [IN3],
    MAX(CASE WHEN Rn = 3 THEN [OUT] END) AS [OUT3],
    MAX(CASE WHEN Rn = 4 THEN [IN] END) AS [IN4],
    MAX(CASE WHEN Rn = 4 THEN [OUT] END) AS [OUT4],
    MAX(CASE WHEN Rn = 5 THEN [IN] END) AS [IN5],
    MAX(CASE WHEN Rn = 5 THEN [OUT] END) AS [OUT5],
    FROM
    SELECT COALESCE(m.DATE_IN,n.DATE_IN) AS DATE_IN,
    COALESCE(m.Seq,n.Seq) AS Seq,
    ID_IN AS [IN],
    ID_OUT AS [OUT],
    ROW_NUMBER() OVER (PARTITION BY Seq ORDER BY COALESCE(m.DATE_IN,n.DATE_IN)) AS Rn
    FROM
    SELECT ROW_NUMBER() OVER (PARTITION BY DATE_IN ORDER BY DATE_IN) AS Seq,*
    FROM TEXT_IN
    )m
    FULL OUTER JOIN
    SELECT ROW_NUMBER() OVER (PARTITION BY DATE_IN ORDER BY DATE_IN) AS Seq,*
    FROM TEXT_OUT
    )n
    ON n.Seq = m.Seq
    AND n.DATE_IN = m.DATE_IN
    )t
    GROUP BY Seq
    to make it dynamic see
    http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to group data for a special case

    Greetings everyone,
    After a long time brought a query for you people. I have a query(using group by also) such that it fetches record in following form
    COLUMN_1         COLUMN_2(%)
    C1                       30
    C2                       40
    C3                       20
    C4                        5
    C                         5Now, I need to display everything in Report as below
    COLUMN_1         COLUMN_2(%)
    C1                       30
    C2                       40
    C3                       20
    C                        10
    Now what happened is all those records for which value of COLUMN_2 is less than some value(say 10 - basically will be picked from some other table) then it should get sum up in a record named as 'C' ( if already exists) else new record named as 'C' should get created with the sum of all such values.
    Problem is - My query is already quite complicated so somehow it is difficult to do so in query itself but do BI Publisher provide me any functionality so that such kind of grouping of data can be done ? Also I need to make a bar graph also out if it.
    Any kind of help in this regard will be highly appreciated.
    Thanks for giving it a look !
    -Sookie

    Am sure, you will be hit road block somewhere else, if you don't do this in the Query.
    Make it easier with the query , rather than BIP.
    You can make the current query as the inline table and do a group based on sum. and decode the column1 name.
    It will save you lot of time.

  • How to group data from SQL queries in XMLP Enterprise Edition

    Hi all,
    I have installed XMLP EE on a windows machine. I tried creating the data set with the type as SQL Query. In my case I have just joined the EMP and DEPT tables from the SCOTT schema:
    select     EMP.EMPNO as EMPNO,
         EMP.ENAME as ENAME,
         EMP.JOB as JOB,
         DEPT.DNAME as DNAME,
         EMP.DEPTNO as DEPTNO
    from     SCOTT.EMP EMP,
         SCOTT.DEPT DEPT
    where DEPT.DEPTNO=EMP.DEPTNO
    and DEPT.DNAME = nvl(:DeptName,DEPT.DNAME )
    I want that the data should be displayed in my report so that for each value of DNAME all the details (EMP.EMPNO, EMP.ENAME, EMP.JOB ) should be displayed as in master detail format in my XML output, so that it is easier to build the template using the <?for-each?> tags.
    Can anyone suggest how I can do this?
    I am facing another error :
    The report cannot be rendered because of an error, please contact the administrator.
    Can anyone help me with this too?
    Thanks.

    Hi
    On the error, have you tried running the report to generate data only ? If that is failing then you have an issue with your query or connection
    On the grouping, hopefully you have the Template Builder installed. That can help you build the grouping you want in the output. For this report and to get you started check out the Table Wizard. There is a screen in that flow allowing you to specify Grouping criteria.
    the following blog article may help too:
    http://blogs.oracle.com/xmlpublisher/2007/05/03#a265
    and this getting started with templates doc
    http://www.oracle.com/technology/products/xml-publisher/xmlpclient.html
    Regards
    Tim

  • How to group data at granularity level hours and every 10 minutes?

    I have sales table imported from SQL server. The date columns are are captured at granularity level such as 30-12-2013 16:50:16. 
    what is best way create master date table, and create relationship between the sales table and the master date table?
    I am new in Power Pivot, and any complete detailed steps and links will be appreciated
    Note: just clarify the requirements. The business wants to see how much sales a consultant sells in  every 10, 30 minutes during normal business hour.
    Hope this help
    jl

    Split your field:
    1) A date portion related to your date dimension at the day grain
    2) A time portion related to your time dimension at a 10 minute grain.
    In TSQL:
    SELECT
    ,[Date] = CAST( <datetimefield> AS DATE) -- date with no time
    ,[Time] = CAST( '18991230 '
    + RIGHT('0' + DATENAME(Hour, <datetimefield>), 2) + ':'
    + RIGHT( '0' + CAST( (DATEPART(MINUTE, <datetimefield>) / 10) * 10 AS NVARCHAR(2)), 2) + ':'
    + '00' AS DATETIME)
    Write this in your query to populate the fact table. This will give you a field holding just the date, and one holding the time at a 10 minute granularity.
    A date table is trivial to produce in SQL or in Excel.
    Here's a link for doing a very basic one in SQL Server.
    A time table is trivial as well:
    WITH TimeCTE ([Time]) AS
    (SELECT CAST('18991230 00:00:00' AS DATETIME)
    UNION ALL
    SELECT DATEADD(MINUTE, 10, [Time])
    FROM TimeCTE
    WHERE [Time] < CAST('18991230 23:50:00' AS DATETIME)
    SELECT * FROM TimeCTE OPTION(MAXRECURSION 0)
    This gives you the beginnings of a dimension with time intervals every 10 minutes.
    You can extend this table with TSQL functions or DAX calculated columns, whichever you find more convenient.
    Then, you can join your <fact table>[Date] to <date dimension>[Date], and your <fact table>[Time] to <time dimension>[Time], and do all of your filtering on those tables.
    Note: I have used a full datetime field for the time dimension above. This is because Power Pivot/Tabular only know datetime as a data type. If you want to add time to a date, the time portion must be recorded on 1899-12-30 to achieve the desired result.
    When importing a TIME data type into the Tabular model, the field is assigned the date of processing, which is absurdly annoying.

  • How to group data in ALV grid display

    Hello Experts,
    I am using REUSE_ALV_GRID_DISPLAY to display my data.
    here, I am using SLIS_T_FIELDCAT_ALV to create field catalog.
    My requirement is data of 1 field/column in ALV had to be displayed by grouping.
    Is there any field any fieldcatalog which I can set so that data will be displayed as after grouping.
    I had searched a lot but found solution for OO ALV but not for function modules.
    Edited by: shubh_ag on Sep 2, 2011 4:38 PM

    Hi shubh,
    try this,
    * Declarations related to ALV Display
    TYPE-POOLS : slis.
    DATA : gt_fcat TYPE slis_t_fieldcat_alv ,
           gs_fcat TYPE slis_fieldcat_alv,
           list_gt_fcat TYPE slis_t_fieldcat_alv ,
           list_gs_fcat TYPE slis_fieldcat_alv,
           gt_listheader TYPE slis_t_listheader,
           gs_listheader TYPE slis_listheader,
           gs_layout TYPE slis_layout_alv,
           list_gs_layout TYPE slis_layout_alv,
           gs_wvar TYPE i VALUE 1.
    DATA: gt_events           TYPE slis_t_event,
          gs_events           LIKE LINE OF gt_events,
          gt_sort             TYPE  slis_t_sortinfo_alv,
          gs_sort             TYPE slis_sortinfo_alv.
    DATA:gs_ovar TYPE disvariant.
    FORM alv_display .
      PERFORM field_catalog.
      PERFORM display_data.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  FIELD_CATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM field_catalog .
      gs_fcat-col_pos   = gs_wvar.
      gs_fcat-tabname   = 'GT_FINAL'.
      gs_fcat-fieldname = 'MATERIAL'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-001.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'DESCRIPTION'.
      gs_fcat-seltext_m = text-011.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'TYPE'.
      gs_fcat-seltext_m = text-002.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'UOM'.
      gs_fcat-seltext_m = text-003.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'PLANT'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-004.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'PURCHASING_GROUP'.
      gs_fcat-seltext_m = text-005.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'MRP_TYPE'.
      gs_fcat-seltext_m = text-006.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'MRP_CONTROLLER'.
      gs_fcat-seltext_m = text-007.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'SPECIAL_PRO '.
      gs_fcat-seltext_m = text-008.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'STORAGE_LOCATION'.
      gs_fcat-seltext_m = text-009.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos   = gs_wvar.
      gs_fcat-tabname   = 'GT_FINAL'.
      gs_fcat-fieldname = 'UNRESTRCITED_STOCK'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-010.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_sort-fieldname = 'MATERIAL'.
      gs_sort-tabname = 'GT_FINAL'.
      gs_sort-subtot = 'X'.
      APPEND gs_sort TO gt_sort.
      gs_sort-fieldname = 'PLANT'.
      gs_sort-tabname = 'GT_FINAL'.
      gs_sort-subtot = 'X'.
      APPEND gs_sort TO gt_sort.
    ENDFORM.                    " FIELD_CATALOG
    *&      Form  DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      DATA:c_top  TYPE slis_formname.
      c_top  = 'TOP'.
    " For avoiding EPC warnings
    CLEAR sy-index.
    IF sy-index EQ 1.
      PERFORM top.
    ENDIF.
      gs_layout-zebra = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = sy-cprog
          i_callback_user_command = 'USER_COMMAND'
          i_callback_top_of_page  = c_top
          is_layout               = gs_layout
          it_fieldcat             = gt_fcat[]
          it_sort                 = gt_sort
          i_default               = 'X'
          i_save                  = 'U'
          is_variant              = gs_ovar
        TABLES
          t_outtab                = gt_final
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " DISPLAY_DATA
    Regards,
    Abhisek

  • How to Group Data from column?

    Hi All,
    Can any one solve my problem please?
    I have Two Column "Age" and "Employee ID".
    I want to Group "Number of Employees" for specific AGE range Like:
    Age | Number of Employees
    20 to 30 | 06
    31 to 40 | 13
    41 to 50 | 16
    51 to 60 | 03
    And data in Columns are fallowing
    Age | Employees ID
    30 | 002
    38 | 008
    33 | 298
    22 | 213
    54 | 083
    24 | 098
    So on.
    Waiting for your HELP.
    In advance Thank you very much...
    Take care

    Here you go..
    Drag any column in Answers and name it as Age and in its fx write
    case
    when tablename.age between 20 and 30 then '20 to 30'
    when tablename.age between 31 and 40 then '31 to 40'
    when tablename.age between 41 and 50 then '41 to 50'
    when tablename.age between 51 and 60 then '51 to 60'
    end
    Drag any column in Answers and name it as "Number of Employees" and in its fx write
    Count(tablename.EmployeeID)
    This would give you the desired Report
    Hope its helpful...
    Thanks
    Ashish Gupta

  • How to group data

    I want to display the total number of employees and, of that total, the number of employees hired in 1995,1996,1997 and 1998. Create appropriate column headingslike shown below(is it possible?)
    [b]No.ofemployees 1995 1996 1997
    20 3 5 6
    employee table structure
    EMPLOYEE_ID NOT NULL NUMBER(6)
    FIRST_NAME VARCHAR2(20)
    LAST_NAME NOT NULL VARCHAR2(25)
    EMAIL NOT NULL VARCHAR2(25)
    PHONE_NUMBER VARCHAR2(20)
    HIRE_DATE NOT NULL DATE
    JOB_ID NOT NULL VARCHAR2(10)
    SALARY NUMBER(8,2)
    COMMISSION_PCT NUMBER(2,2)
    MANAGER_ID NUMBER(6)
    DEPARTMENT_ID NUMBER(4)
    No.ofemployees 1995 1996 1997
    20 3 5 6

    select count(*),
      count(decode(extract(year from hiredate),1980,1)) "1980",
      count(decode(extract(year from hiredate),1981,1)) "1981",
      count(decode(extract(year from hiredate),1982,1)) "1982",
      count(decode(extract(year from hiredate),1987,1)) "1987"
    from emp;
      COUNT(*)       1980       1981       1982       1987
            14          1         10          1          2

  • How to group rows based on a formula value

    Hi experts,
    I have a query that returns a a char row (country) and a couple of columns, "Duration of Process in days" and "Counter of nº process done", each a calculated formula KF .
    What I would like is to group the results based on formula KF1 results ""Duration of Process in days".
    For example: from this query result
    Country  -   Duration of Process in Days  -   Counter of nº process done
    ES                      1                                         3
    PT                      3                                         2
    UK                      4                                         3
    IT                       1                                          5
    US                      6                                         2
    FR                      1                                         3
    DE                      4                                         5
    get the following: aggregated by all possible formula values "Duration of Process in Days"
    Duration of Process in Days  -   Counter of nª process
                    1                                       11   (353)
                    3                                         2
                    4                                         8    (3+5)
                    6                                         2
    Is this possible??
    Thanks in advance for your help,
    Best regards,
    Enric

    Hi Vikram,
    my problem is that the "Duration in days" cannot be a characteristic derived in the loading process, as its value depends (is calculated) based on several user's selections done in the variable pop-up screen when executing the report.
    Thanks again for your reply.
    Enric

  • Group Data locked for material

    Hi,
    I have an interface that failed because the "Group Data" of the material was locked.
    I am aware of "Material being locked by another user". However I don't know how the group data gets locked or what group data refers to.
    In most cases when I run the interface after some time, the material posts correctly. But I'd like to know what exactly locks group data and how I can check if it has been unlocked subsequently.
    Thanks.
    Urmila

    Hi,
      This message comes usually when you attempt to change the material using fm calls and material header MARA is locked (that is material itself is locked) by some other user .
      What you can do is to call lock fm ENQUEUE_EMMARAE
      before calling your material update logic and see whether the lock is successful. If the lock is successful then you can proceed with the update logic.
    Sri

  • How to control outer group data based on inner group data

    Hi ,
    Please can anyyone help me on this issue.
    I have one invoice header record and for that invoice there are 15invoice lines record.
    1)my requirement is i want to print the 10 invoice records in first page and remaining records,in next page.--this i had achieved*(byusing solution posted inthe forum)*
    i have the layout like this
    image:!C:\Documents and Settings\madhu.rn\Desktop\layout.jpg!
    main group data table
    i had inserted another table for inner group data.
    again main group data in main table.
    2)But here i don't want print header info again in second page.
    3)i am not getting the line numbers in inner group in ascending order ,i am getting in descending order. how to get them in decending order
    4) if lines record are going to second page i don't want to print subtotal,tax,total (these are main group data)in first page, instead of this
    in place of
    subtotal-- want to print Continued......
    Tax- null
    Total:page 1 of 2. like that i want to print in first page.
    i want them to print in second page.
    5)the bottom portion also not to print on second page.(after innergroup data,there is some main group data)
    i have one doubt by using inner group data whether we can control outer group data.
    if any of my requirement's are not possible to meet ,please provide me the information.
    This urgent for me,have to submit it.
    Edited by: user644268 on Feb 8, 2010 11:10 AM

    Hi,
    Please help me in this issue. Its an urgent requirement.
    Thanks in Advance..

  • How to populate data in PAY_PEOPLE_GROUPS table (People Group Flexfiled)

    Hello
    We are migrating the data from one oracle instance to another oracle instance which are in same version of Oralce Applications 11.5.10.2. As a part of migration can anybody let me know how to populate data in "People Group Key Flexfiled" (PAY_PEOPLE_GROUPS table), ideally I will create or update employee records from the source instance to destination instance, so while creating or updating the employee records in can pass people_group_id while calling to the assignment api but my question here is before passing group id to the api i should have the data populated in PAY_PEOPLE_GROUPS TABLE so that i can fetch the group id as per the combination and pass it in to the api.. please suggest...

    Thanks for your information! by any chance do you have any sample code which will create/update assignments with People Group Flexfield; when i check "hr_assignment_api.update_emp_asg_criteria" it only has parameter to pass people group id and not having segments parameters to pass individual segments.
    Also let me know the links if you have any for all HR API guide which will help me to develope the interfaces...
    My requirement is we have two instances in which in one instance we are treating as source for HR which will be used to master for all HR related activities and we are planning to develope an interface which will bring master instance in sync with dummy instance.

  • How to display data from a recordset based on data from another recordset

    How to display data from a recordset based on data from
    another recordset.
    What I would like to do is as follows:
    I have a fantasy hockey league website. For each team I have
    a team page (clubhouse) which is generated using PHP/MySQL. The one
    area I would like to clean up is the displaying of the divisional
    standings on the right side. As of right now, I use a URL variable
    (division = id2) to grab the needed data, which works ok. What I
    want to do is clean up the url abit.
    So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end all
    I want is clubhouse.php?team=Wings.
    I have a separate table, that has the teams entire
    information (full team name, short team, abbreviation, conference,
    division, etc. so I was thinking if I could somehow do this:
    Recordset Team Info is filtered using URL variable team
    (short team). Based on what team equals, it would then insert this
    variable into the Divisional Standings recordset.
    So example: If I type in clubhouse.php?team=Wings, the Team
    Info recordset would bring up the Pacific division. Then 'Pacific'
    would be inserted into the Divisional Standings recordset to
    display the Pacific Division Standings.
    Basically I want this
    SELECT *
    FROM standings
    WHERE division = <teaminfo.division>
    ORDER BY pts DESC
    Could someone help me, thank you.

    Assuming two tables- teamtable and standings:
    teamtable - which has entire info about the team and has a
    field called
    "div" which has the division name say "pacific" and you want
    to use this
    name to get corresponding details from the other table.
    standings - which has a field called "division" which you
    want to use to
    give the standings
    SELECT * FROM standings AS st, teamtable AS t
    WHERE st.division = t.div
    ORDER BY pts DESC
    Instead of * you could be specific on what fields you want to
    select ..
    something like
    SELECT st.id AS id, st.position AS position, st.teamname AS
    team
    You cannot lose until you give up !!!
    "Leburn98" <[email protected]> wrote in
    message
    news:[email protected]...
    > How to display data from a recordset based on data from
    another recordset.
    >
    > What I would like to do is as follows:
    >
    > I have a fantasy hockey league website. For each team I
    have a team page
    > (clubhouse) which is generated using PHP/MySQL. The one
    area I would like
    > to
    > clean up is the displaying of the divisional standings
    on the right side.
    > As of
    > right now, I use a URL variable (division = id2) to grab
    the needed data,
    > which
    > works ok. What I want to do is clean up the url abit.
    >
    > So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end
    > all
    > I want is clubhouse.php?team=Wings.
    >
    > I have a separate table, that has the teams entire
    information (full team
    > name, short team, abbreviation, conference, division,
    etc. so I was
    > thinking if
    > I could somehow do this:
    >
    > Recordset Team Info is filtered using URL variable team
    (short team).
    > Based on
    > what team equals, it would then insert this variable
    into the Divisional
    > Standings recordset.
    >
    > So example: If I type in clubhouse.php?team=Wings, the
    Team Info recordset
    > would bring up the Pacific division. Then 'Pacific'
    would be inserted into
    > the
    > Divisional Standings recordset to display the Pacific
    Division Standings.
    >
    > Basically I want this
    >
    > SELECT *
    > FROM standings
    > WHERE division = <teaminfo.division>
    > ORDER BY pts DESC
    >
    > Could someone help me, thank you.
    >

Maybe you are looking for

  • Time not accurate on iPad??

    My iPhone and my iPad do not agree on the time of day. I set them both up in the same time zone and reset both devices. The iPad thinks it is five minutes ahead of the phone. I believe the phone gets the time from the cell towers and the wifi iPad? W

  • Events: sharing and syncing

    I have been hesitant to use iPhoto in the past. Seams much easier just to have a folder in finder. But there are a few perks with using it, so I've decided to go a head and use it. Especially having multiple Macs in the family, the wife wants to see

  • How do I determine expected output size for System Exec vi

    I am running a DOS exe from a Batch file using the System Exec vi. My exe is programming software for a microcontroller and passes data to the programmer via the serial port. When I run the batch file externaly to LabView it works fine. When I run th

  • How to create own api documentation

    hi i am having my own classes. Is there any method to create the documentation for them in java format. I heard it is possible. If so how to create? thanks

  • Shortcuts to other programs only open in Word 2007 after upgrade to Firefox 17

    I had shortcuts to Volgistics and Facebook already on my desktop when I updated recently to Firefox 17. Since the update, those shortcuts direct those programs to Word 2007 which then opens the program into read-only in Word 2007. I can, however, con