Sorting and Grouping -Two months in this query

Hi All,
many thanks for jeneesh
i am doing project for construction company, i face this problem in grouping points according to relation between these points the
Relation is from 1 to 100. If the point between this rang that mean there is relation between these points.
this question already solve but the results not correct when the table has more data.
SQL - sorting and grouping.
from jeneesh and many thanks for him.
This example for more clarifications
for example i have these points
id   location         percentage   comments
1     loc 1,2          20%                that mean point  1 and 2 close to each other by 20%
2     loc 1,3          40%              that mean point 1 and 3 close to each other byy 40%
3     Loc 8,6          25%               that mean point 8 and 6 close to each other by 25%
4     Loc  6,10        20%
5     LOC 11,10        10 %
6     LOC 15,14         0%Also , we can see the relation between these points as follwoing
- points 1,2,3 in one group why becuase 1,2 has relation and 1,3 has relation that mean 1,3 also has hidden relation.
- Points 6,8,10,11 in second group there are relations between them .
- but no relation between 1 or 2 or 3 with any point of 6,8,9,10,11
- as well as no relation between 15, 14 that mean 14 in third group and 15 in fourth group.
whati need?
to group the points that has relation according to percentage value ascending
The most important part is to group the points. SO , the below query the gropuing is not correct.
I have the follwoing table with data
drop table temp_value;
create table temp_value(id number(10),location varchar2(20), percentage number(9));
insert into temp_value values  (1,'LOC 1,2',10);
insert into  temp_value values (2,'LOC 1,3',0);
insert into  temp_value values (3,'LOC 1,4',0);
insert into  temp_value values (4,'LOC 1,5',0);
insert into  temp_value values (5,'LOC 1,6',0);
insert into  temp_value values (6,'LOC 2,3',0);
insert into  temp_value  values(7,'LOC 2,4',0);
insert into  temp_value values (8,'LOC 2,5',30);
insert into  temp_value values (9,'LOC 2,6',0);
insert into  temp_value values (10,'LOC 3,4',0);
insert into  temp_value values (11,'LOC 3,5',0);
insert into  temp_value values (12,'LOC 4,5',40);
insert into  temp_value values (13,'LOC 4,6',0);
insert into  temp_value values (14,'LOC 6,7',40);
insert into  temp_value values (15,'LOC 7,2',0);
insert into  temp_value values (16,'LOC 8,2',60);
insert into  temp_value values (17,'LOC 8,3',0);
insert into  temp_value values (18,'LOC 3,1',0);
insert into  temp_value values (19,'LOC 9,6',30);
insert into  temp_value values (20,'LOC 11,2',0);
insert into  temp_value values (22,'LOC 12,3',10);
insert into  temp_value values (23,'LOC 19,3',0);
insert into  temp_value values (24,'LOC 17,3',0);
insert into  temp_value values (24,'LOC 20,3',0);when i used this query , the results is not correct
with t as
    (select percentage,loc1,loc2,sum(case when percentage = 0 then 1
                       when loc1 in (l1,l2) then 0
                   when loc2 in (l1,l2) then 0
                   when l1 is null and l2 is null then 0
                   else 1
              end) over(order by rn) sm
    from (     select id,location,percentage,
                       regexp_substr(location,'\d+',1,1) LOC1,
                      regexp_substr(location,'\d+',1,2)  LOC2,
                     lag(regexp_substr(location,'\d+',1,1))
                      over(order by percentage desc) l1,
                      lag(regexp_substr(location,'\d+',1,2))
                      over(order by percentage desc) l2,
              row_number() over(order by percentage desc) rn
      from temp_value
      order by percentage desc
   select loc,min(sm)+1 grp
     from(
       select loc,rownum rn,sm
       from(
       select percentage,decode(rn,1,loc1,loc2) loc,sm
       from t a,
            (select 1 rn from dual union all
             select 2 from dual ) b
       order by percentage desc,decode(rn,1,loc1,loc2) asc
    group by loc
   order by min(sm),min(rn);the results
SQL> /
LOC                         GRP
2                             1
8                             1
6                             2
7                             2
4                             3
5                             3
9                             4
1                             5
12                            6
3                             6
11                           13
LOC                         GRP
19                           14
17                           15
20                           22
14 rows selected.SQL>
but the correct is
Location        group No
2                  1
8                  1
4                  1
5                  1
1                  1
6                  2
7                  2
9                  2
12                 3
3                  3
19                 4
17                 5
20                 6many thanks in advance.
Edited by: Ayham on Nov 30, 2012 3:07 AM

Thanks,
i want the sorting for each group DESC not all groups to gather
when i used your query i get
SQL> with connects as (
  2  select distinct
  3   loc1
  4  ,loc2
  5  ,dense_rank() over (order by connect_by_root(loc1)) grp
  6  from temp_value
  7  start with
  8  percentage != 0
  9  connect by nocycle
10  (prior loc2 = loc1
11  or
12  prior loc1 = loc2
13  or
14  prior loc1 = loc1
15  or
16  prior loc2 = loc2)
17  and
18  percentage != 0
19  )
20  ,  got_grp AS
21  (
22     select
23      loc
24      ,dense_rank() over (order by grp) grp
25      from (
26      select
27       loc
28       ,max(grp) keep (dense_rank first order by grp) grp
29       from (
30       select
31        loc1 loc
32        ,grp
33        from connects
34        union
35        select
36         loc2
37         ,grp
38         from connects
39         )
40         group by
41         loc
42        )
43  )
44  SELECT       loc
45  ,    grp
46  FROM         got_grp
47  ORDER BY  COUNT (*) OVER (PARTITION BY grp)   DESC
48  ,            grp
49  ,    loc
50  ;The output is
LOC                         GRP
1                             1
2                             1
4                             1
5                             1
8                             1
6                             3
7                             3
9                             3
12                            2
3                             2
10 rows selected.but i want it like this
Loc  Grp
2      1
8      1
4      1
5      1
1      1
12    2
3      2
6      3
7      3
9      3So , the sorting for each group Separate based on the percentage column.
many thanks
Edited by: Ayham on Nov 30, 2012 9:43 AM

Similar Messages

  • Using member sorting and grouping with two reports sharing rows

    Hi!
    I have a problem with one report and I need some help or advise here.
    I have two dimensions with dynamic expansion in rows (PRODUCT, MATERIAL), and I use the option Member Sorting and Grouping at Member selector to obtain the total amount of PRODUCT group by PARENTH1:
    PRODUCT               MATERIAL          AMOUNT
    TOTAL PROD_A-X                                   100
    PROD_A_A             MAT1                          22
    PROD_A_B             MAT1                          50
    PROD_A_A             MAT2                          28 
    TOTAL PROD_B-X                                   120
    PROD_B_A             MAT1                          30
    PROD_B_A             MAT2                          50
    PROD_B_B             MAT2                          40
    This works fine if I only have one report, but I need to create another one sharing the row and page axis with the Default Report, when I do that the option Member Sorting and Grouping doesn't work. I really need to have two reports with shared rows and also the summation by PARENTH1, how can I do that?
    Thank you very much

    Hi!
    I have a problem with one report and I need some help or advise here.
    I have two dimensions with dynamic expansion in rows (PRODUCT, MATERIAL), and I use the option Member Sorting and Grouping at Member selector to obtain the total amount of PRODUCT group by PARENTH1:
    PRODUCT               MATERIAL          AMOUNT
    TOTAL PROD_A-X                                   100
    PROD_A_A             MAT1                          22
    PROD_A_B             MAT1                          50
    PROD_A_A             MAT2                          28 
    TOTAL PROD_B-X                                   120
    PROD_B_A             MAT1                          30
    PROD_B_A             MAT2                          50
    PROD_B_B             MAT2                          40
    This works fine if I only have one report, but I need to create another one sharing the row and page axis with the Default Report, when I do that the option Member Sorting and Grouping doesn't work. I really need to have two reports with shared rows and also the summation by PARENTH1, how can I do that?
    Thank you very much

  • Sorting and Grouping in Projects View

    In Projects view, when either of two of the three grouping options is selected, there are two sorts in effect: the groups themselves are sorted, and the contents of each group are sorted. These sorts are handled differently, depending on the grouping selected and the sort order selected.
    (It appears that there is a bit of the old Apple voodoo in here. The results are arbitrary , but they seem to have been carefully chosen to meet most users expectations. That is to say -- and this is an Apple programming trait -- the arbitrariness is faithful to the expected users' needs, not to logic.)
    There are four sorts available, and three groupings
    Sorts:
    . Name
    . Date -- Oldest First
    . Date -- Newest First
    . Library
    Groupings:
    . Ungrouped
    . Group by year
    . Group by folder
    So that's twelve possible ways to display Projects in Projects view.
    Let's look at a few of them. I'm going to refer to the groups as "Year groups" or "Folder groups" and to the contents of the groups as "Projects". So there is sorting of the groups, and sorting of the contents of the groups (same as "within the group"). These I'll refer to as "Groups sorting" and "Projects sorting".
    Sort: Date -- Newest First
    Grouping: Group by Year
    Result: Year groups are sorted in the same order as Projects. Projects which span multiple years are put in multi-year groups. Projects with the same spans are grouped together.
    Sort: Date -- Oldest First
    Grouping: Group by Year
    Results are as expected; a reversal of the "Newest First" sort, but with the same groups: Year groups are sorted in the same order as Projects. Projects which span multiple years are put in multi-year groups. Projects with the same spans are grouped together.
    Sort: Name
    Grouping: Group by Year
    Result: Year groups are sorted by year, oldest first. Projects which span multiple years are put in multi-year groups. Projects with the same spans are grouped together. Projects are sorted alphabetically, descending.
    Sort: Library
    Grouping: Group by year
    Result: Year groups are sorted by year, oldest first. Projects which span multiple years are put in multi-year groups. Projects with the same spans are grouped together. Projects are listed in the order they occur in the Library structure shown on the Library tab of the Inspector. (Note that this last is literal: a Project named "Aardvark Close-ups" if it's in a Folder named "Zoography" will be listed after all the projects in "Yellow Paintings" and all the Projects in "X-rays, thoracic" if those Projects are in alphabetical order by Folder name in the Library. You can see all the Projects in your Library listed on the Library tab of the Inspector by "{Option}+clicking" the disclosure triangle next to "PROJECTS & ALBUMS" twice.)
    Sort: Date - Newest First
    Grouping: Group by folder
    Result: Folder groups are sorted alphabetically by name, descending. Projects are sorted by date, newest first. Clicking a Folder's name in the Project viewer drills down to show the sub-Folders and Projects in the clicked Folder.
    Sort: Date - Oldest First
    Grouping: Group by folder
    Result: Folder groups are sorted alphabetically by name, descending. Projects are sorted by date, oldest first. Clicking a Folder's name in the Project viewer drills down to show the sub-Folders and Projects in the clicked Folder (where, again, Folder groups are sorted alpha-name, descending, and Projects are sorted alpha-name, descending).
    Sort: Name
    Grouping: Group by folder
    Result: Folder groups are sorted alphabetically by name, descending. Projects are sorted alphabetically by name, descending. Clicking a Folder's name in the Project viewer drills down to show the sub-Folders and Projects in the clicked Folder (where, again, Folder groups are sorted alpha-name, descending, and Projects are sorted alpha-name, descending).
    Sort: Library
    Grouping: Group by folder
    Result: Folder groups are sorted alphabetically by name, descending. Projects are listed in the order they occur in the Library structure shown on the Library tab of the Inspector (see note above). Clicking a Folder's name in the Project viewer drills down to show the sub-Folders and Projects in the clicked Folder (where, again, Folder groups are sorted alpha-name, descending, and Projects are listed in the order they appear in the Library).
    Ernie [asked:|http://discussions.apple.com/thread.jspa?threadID=2816124&tstart=0]
    +I see those icons but note that those projects in folders will be in different sections arranged alpha, and then date within. Am I correct on that?+
    The answer is, it depends.
    If "Group by year" is selected, the Groups-sorting will always be by date, regardless of the sort order specified. The Groups-sorting order will follow whatever is specified for the Projects sort order (or default to "oldest first").
    If "Group by folder" is selected, the Groups-sorting will always be alphabetical, descending, regardless of the sort order specified. (So if you use Projects view, take care in naming your Folders. Use prefixes if needed to force a desired alpha sort.)
    If "Ungrouped" is selected, there are no Groups and perforce no Groups-sorting.
    That's all I have to say on this topic (today).
    Message was edited by: Kirby Krieger

    In Projects view, when either of two of the three grouping options is selected, there are two sorts in effect: the groups themselves are sorted, and the contents of each group are sorted. These sorts are handled differently, depending on the grouping selected and the sort order selected.
    (It appears that there is a bit of the old Apple voodoo in here. The results are arbitrary , but they seem to have been carefully chosen to meet most users expectations. That is to say -- and this is an Apple programming trait -- the arbitrariness is faithful to the expected users' needs, not to logic.)
    There are four sorts available, and three groupings
    Sorts:
    . Name
    . Date -- Oldest First
    . Date -- Newest First
    . Library
    Groupings:
    . Ungrouped
    . Group by year
    . Group by folder
    So that's twelve possible ways to display Projects in Projects view.
    Let's look at a few of them. I'm going to refer to the groups as "Year groups" or "Folder groups" and to the contents of the groups as "Projects". So there is sorting of the groups, and sorting of the contents of the groups (same as "within the group"). These I'll refer to as "Groups sorting" and "Projects sorting".
    Sort: Date -- Newest First
    Grouping: Group by Year
    Result: Year groups are sorted in the same order as Projects. Projects which span multiple years are put in multi-year groups. Projects with the same spans are grouped together.
    Sort: Date -- Oldest First
    Grouping: Group by Year
    Results are as expected; a reversal of the "Newest First" sort, but with the same groups: Year groups are sorted in the same order as Projects. Projects which span multiple years are put in multi-year groups. Projects with the same spans are grouped together.
    Sort: Name
    Grouping: Group by Year
    Result: Year groups are sorted by year, oldest first. Projects which span multiple years are put in multi-year groups. Projects with the same spans are grouped together. Projects are sorted alphabetically, descending.
    Sort: Library
    Grouping: Group by year
    Result: Year groups are sorted by year, oldest first. Projects which span multiple years are put in multi-year groups. Projects with the same spans are grouped together. Projects are listed in the order they occur in the Library structure shown on the Library tab of the Inspector. (Note that this last is literal: a Project named "Aardvark Close-ups" if it's in a Folder named "Zoography" will be listed after all the projects in "Yellow Paintings" and all the Projects in "X-rays, thoracic" if those Projects are in alphabetical order by Folder name in the Library. You can see all the Projects in your Library listed on the Library tab of the Inspector by "{Option}+clicking" the disclosure triangle next to "PROJECTS & ALBUMS" twice.)
    Sort: Date - Newest First
    Grouping: Group by folder
    Result: Folder groups are sorted alphabetically by name, descending. Projects are sorted by date, newest first. Clicking a Folder's name in the Project viewer drills down to show the sub-Folders and Projects in the clicked Folder.
    Sort: Date - Oldest First
    Grouping: Group by folder
    Result: Folder groups are sorted alphabetically by name, descending. Projects are sorted by date, oldest first. Clicking a Folder's name in the Project viewer drills down to show the sub-Folders and Projects in the clicked Folder (where, again, Folder groups are sorted alpha-name, descending, and Projects are sorted alpha-name, descending).
    Sort: Name
    Grouping: Group by folder
    Result: Folder groups are sorted alphabetically by name, descending. Projects are sorted alphabetically by name, descending. Clicking a Folder's name in the Project viewer drills down to show the sub-Folders and Projects in the clicked Folder (where, again, Folder groups are sorted alpha-name, descending, and Projects are sorted alpha-name, descending).
    Sort: Library
    Grouping: Group by folder
    Result: Folder groups are sorted alphabetically by name, descending. Projects are listed in the order they occur in the Library structure shown on the Library tab of the Inspector (see note above). Clicking a Folder's name in the Project viewer drills down to show the sub-Folders and Projects in the clicked Folder (where, again, Folder groups are sorted alpha-name, descending, and Projects are listed in the order they appear in the Library).
    Ernie [asked:|http://discussions.apple.com/thread.jspa?threadID=2816124&tstart=0]
    +I see those icons but note that those projects in folders will be in different sections arranged alpha, and then date within. Am I correct on that?+
    The answer is, it depends.
    If "Group by year" is selected, the Groups-sorting will always be by date, regardless of the sort order specified. The Groups-sorting order will follow whatever is specified for the Projects sort order (or default to "oldest first").
    If "Group by folder" is selected, the Groups-sorting will always be alphabetical, descending, regardless of the sort order specified. (So if you use Projects view, take care in naming your Folders. Use prefixes if needed to force a desired alpha sort.)
    If "Ungrouped" is selected, there are no Groups and perforce no Groups-sorting.
    That's all I have to say on this topic (today).
    Message was edited by: Kirby Krieger

  • Sorting and Grouping by multi-value Choice columns - any options?

    I found out the hard way that SharePoint doesn't support sorting or grouping lists by Choice columns that are set to "Allow Multiple Values." I'm stunned by this missing capability, and my project has come to a complete halt without it. It's like Microsoft only implemented hafl the feature -- you can put data in, but then you can't do anything with it. You can't even use the column in a formula in another column, so you can't parse it.
    I'm not posting just to gripe though. Does anyone have any suggestions for alternatives? What do you do when you need to let people make multiple selections, and then you want to sort or group by those values? Are there any add-on products that allow this? At this point my only option seems to be to not allow multiple choices, but that's taking away a rather significant feature.
    Thanks for any ideas,
    Steve

    Hi Paul,
    Thank you for the reply and the additional questions. For my situation I want to use the multi-value choice to indicate a "belongs to" relationship, as in "this item belongs to projectA, projectB, and project C. Because there are more than 10 projects, I didn't want to create a separate Yes/No checkbox for each one.
    For viewing the information, I'm looking primarily for a "group by" function.  So if an item belongs to projectA, projectB, and projectC, it would appear three times, once under the grouping for each project. What I don't want is for a row that only belongs to projectA to be grouped separately from a row that belongs to both projectA and projectB. I want to see all the rows that belong to projectA grouped together, regardless of whether they also belong to other projects.
    I'll look into using a grid control, but if you have any other suggestions I'll certainly listen.
    Steve

  • TableModel with SORT and GROUP BY functions solution.

    Hello all,
    I'd like to represent an EnvelopeTableModel. This class is developed to incapsulate another TableModel and allow user to reorder and group data without changing original values and orders.
    It allows to perform multi column sortings and grouping and
    supports following group functions: EMPTY, COUNT, MIN, MAX, SUM, AVG.
    Here you can download the library, demo version and documentation.
    http://zaval.org/products/swing/
    It would be great to know all your opinions.
    With best regards
    Stanislav Lapitsky

    About 1) and 3).
    These suggestions are almost the same. These features will change GUI component but i want to improve TableModel instead of JTable.
    Using the model user can use JTable for data representation.
    Of course I can improve JTable component and add multiline row/column headers with ability to reorder/group data from component and a lot of another widgets but it isn't my goal.
    About 2) What do you mean "crosstab"?
    Thanks for your 2-cents :-).
    With best regards
    Stas

  • Swatches CS3 - Sorting and grouping possible?

    Hello,
    a simple question. Is it possible to sort or group swatches?
    If the answer is yes, how do I do it?
    Thanks,
    Matt

    You can select and drag them up and down the panel.
    k

  • XSL - Sort and Group?

    Hello,
    Anyone know if there is a way to do something like this?
    Original XML:
    <item>
    <word>word1</word><num>10</num><num2>9</num2>
    </item>
    <item>
    <word>word2</word><num>5</num><num2>3</num2>
    </item>
    <item>
    <word>word1</word><num>7</num><num2>6</num2>
    </item>
    I want to do something like group on <word> and sort accending on sum(<num>), min(<num2>) and end up with this:
    <item>
    <word>word1</word><num>17</num><num2>6</num2>
    </item>
    <item>
    <word>word2</word><num>5</num><num2>3</num2>
    </item>
    Is this possible?
    thanks,
    chad.

    Here's a start. See Chapter 9 of my book for a complete explanation of how to exploit XSLT keys like database functional indexes to make grouping operations like this be fast in XSLT. It takes a bit to wrap your mind around why and how it works and the book has figures that help illustrate this.
    <!-- chad.xml -->
    <list>
    <item>
    <word>word1</word><num>10</num><num2>9</num2>
    </item>
    <item>
    <word>word2</word><num>5</num><num2>3</num2>
    </item>
    <item>
    <word>word1</word><num>7</num><num2>6</num2>
    </item>
    </list>
    <!-- chad.xsl -->
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:key name="g" match="item" use="word"/>
    <xsl:output indent="yes"/>
    <xsl:template match="/">
    <list>
    <xsl:for-each select="list/item[generate-id(.)=generate-id(key('g',word)[1])]">
    <xsl:sort data-type="number" select="sum(key('g',word)/num)"/>
    <xsl:variable name="items-with-same-word" select="key('g',word)"/>
    <item>
    <word><xsl:value-of select="word"/></word>
    <num><xsl:value-of select="sum($items-with-same-word/num)"/></num>
    <num2><xsl:value-of select="sum($items-with-same-word/num2)"/></num2>
    </item>
    </xsl:for-each>
    </list>
    </xsl:template>
    </xsl:stylesheet>This produces the output:
    <list>
    <item>
    <word>word2</word>
    <num>5</num>
    <num2>3</num2>
    </item>
    <item>
    <word>word1</word>
    <num>17</num>
    <num2>15</num2>
    </item>
    </list>

  • Alv Sort and Grouping

    Hello Friends,
    I have made an ALV report where I am sorting on the second column which is a field called 'SUPPLIER_ID'.
    I am to group the supplier_id, so that only the first row shows the supplier id, and those rows with the same id should not be shown. But am having trouble with this.
    check  Supplier ID     field2  field3
               xxxxx            xxx    xxx
                                    xxx   xxx
                                    xxx   xxx
              xxxxxx           xxx    xxx.
    These are the steps I do in the code.
    1. I build the fieldcatalogue
    2. then I select the data
    3 . set the sort order
         DATA: x_sort TYPE slis_sortinfo_alv.
         CLEAR x_sort.
         x_sort-fieldname =  'SUPPLIER_ID'.
         x_sort-tabname   = 'GT_OUTTAB'.
         x_sort-up = 'X'
         x_sort-spos = 2.
         APPEND x_sort TO t_sort.
    4. Then I call the Reuse function.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         IS_LAYOUT                         = ls_layout
         IT_FIELDCAT                       = t_fieldcat
         i_callback_pf_status_set       = l_status
         i_callback_program               = l_repid
         it_sort                                  = x_sort
       TABLES
          T_OUTTAB                          = gt_outtab
       EXCEPTIONS
         PROGRAM_ERROR                     = 1
         OTHERS                            = 2
    But all the rows show the supplier ID, what am I doing wrong?
    best regards B
    Edited by: Baljinder Singh Gosal on Sep 29, 2008 2:36 PM

    types: begin of gs_outtab.
    types:
             SUPPLIER             TYPE ZSAM_LAC-SUPPLIER,
             SUPPLIER_ID        TYPE ZSAM_LAC-SUPPLIER_ID,
             SPEND                 TYPE ZSAM_LAC-SPEND,
             lights               type char1,
             color                type i,
             tabcol               type lvc_t_scol,
             id                   type char25,
             name                 type icon-name,
             symbol               type icon-id,
    end   of gs_outtab.
    data: gt_outtab type standard table of gs_outtab,
          wa_outtab  type gs_outtab.
    data: gr_container type ref to cl_gui_custom_container,
          gs_layout type lvc_s_layo,
          gt_fieldcat type lvc_t_fcat.
    perform display.
    form display.
        data: ls_layout   type slis_layout_alv,
              t_fieldcat  TYPE slis_t_fieldcat_alv,
               x_sort     TYPE slis_sortinfo_alv
              t_sort      TYPE slis_t_sortinfo_alv,
              l_status    TYPE slis_formname,
              l_repid     TYPE syrepid.
         REFRESH t_sort.
         REFRESH t_fieldcat.
         g_pf_status = 'SALV_STANDARD'.
         l_status = 'SET_PF_STATUS'.
         l_repid = sy-repid.
    Layout
         ls_layout-lights_tabname   = '1'.
       ls_layout-lights_fieldname = 'LIGHTS'.
         ls_layout-coltab_fieldname =  'TABCOL'.
       ls_layout-zebra = 'X'.
         PERFORM set_fieldcat2 USING:
    *pos fieldname          ref_field           ref_tab   len   noout  text_m   text_l   txt_s    reptxt  ddic  hotsp icon  chckbx edit  dosum  inttype symbol   tech     group fieldcat
    1   'CHECK'            'XFELD'              space     space space 'Select' 'Select' 'Sel'    'Select' space space space 'X'   'X'    space   space     space   space  space   t_fieldcat,
    2   'SUPPLIER'         'SUPPLIER'          'ZSAM_LAC' space space  text-hl5 text-hl5 text-hl5 space   space space space  space space space   space     space   space  space   t_fieldcat,
    3   'SUPPLIER_ID'      'SUPPLIER_ID'       'ZSAM_LAC' space space  text-hl4 text-hl4 text-hl4 space   space space space  space space space   space     space   space  'A'   t_fieldcat,
      perform get_data
      perform set_icons.
      perform set_order USING 'ORKLA_COMP_NAME' 'GT_OUTTAB' 'X' space space t_sort.
      CLEAR x_sort.
      x_sort-fieldname = 'SUPPLIER_ID'.
      x_sort-tabname   = 'GT_OUTTAB'.
      x_sort-up = 'X'.
      x_sort-spos = 1.
      APPEND x_sort TO t_sort.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         IS_LAYOUT                         = ls_layout
         IT_FIELDCAT                       = t_fieldcat
         IT_EXCEPT_QINFO                   = gt_exc
         i_callback_pf_status_set          = l_status
         i_callback_program                = l_repid
         it_sort                           = t_sort
       TABLES
          T_OUTTAB                          = gt_outtab
       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_fullscreen

  • PLD sorting and grouping

    Hello
    I would like to raise a question I am not able to answer
    I want to group invoice at the end of the month with all delivery notes created within the month
    The question is that some lines are text lines and there is no DN attached to the the line
    as a result on the invoice the first group is DN without number grouping all empty lines
    then I can see the grouping of delivery notes number
    My question is how to delete on the lay-out the text lines so the document is clean and not showing a group of empty lines at the start of the document
    thank you

    Hi,
    1. Create a field with variable 157, let's say it's field F_001
    2. Create a formula field: F_002: F_001!='T'
    3. Link all the row level fields on the repetitive area to this formula field. They will be displayed only if the row type is not text.
    Regards,
    Nat

  • Audiobook sorting and grouping

    How do I group the audiobooks on a iPod nono G5. The same audiobook works perfectly on my iPhone, but when i add them to my iPod the books don't group and all the tracks are sorted by track names, so all the books are mixed in one long list.

    This is a very annoying bug which Apple do not seem to be addressing. If you look at the previous thread "Major Audio book problem ipod 5th gen" then you will find some workaround.
    Hope it helps

  • Sorting and grouping issue in WDP-ALV table

       lr_field->if_salv_wd_sort~create_sort_rule(
              EXPORTING
                sort_order        = if_salv_wd_c_sort=>sort_order_ascending
                group_aggregation = abap_true ).
    And while binding data, I'm sorting the internal table having data as below
    SORT wd_assist->gt_details_table(itab) BY bproc bsubproc function field ASCENDING.And output is as follows
    In the above snapshot, The sorting is getting disturbed on colunm: Function......
    But required output should be as below
    Pls help me how to achieve this?
    Thanks
    Katrice

    Hi Sandesh,
    When we use the SALV_WD_TABLE component to display ALV, by default, all columns are arranged in the same order as the attributes in the context node of your
    application.
    You need to add the following code in the wddomodifyview( ) method of your View.
    METHOD wddomodifyview
    data:lt_columns type salv_wd_t_column_ref,
            ls_column  type salv_wd_s_column_ref,
            lo_column  type ref to cl_salv_wd_column ,
            lo_ref_cmp_usage  type ref to if_wd_component_usage,
           lo_ref_interfacecontroller type ref to iwci_salv_wd_table ,
           lo_value type ref to cl_salv_wd_config_table.
    * Get  reference to the Component usage of the ALV.
    lo_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
    IF lo_ref_cmp_usage->has_active_component( ) IS INITIAL.
    lo_ref_cmp_usage->create_component( ).
    ENDIF.
    * Get reference to the Interface controller of the ALV.
    lo_ref_interfacecontroller= wd_this->wd_cpifc_alv( ).
    lo_value = lo_ref_interfacecontroller->get_model( ).
    * Get the Columns of the ALV
    CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
      RECEIVING
    value = lt_columns.
    * Get reference to each column and set the column position
    LOOP AT lt_columns INTO ls_column.
    lo_column = ls_column-r_column.
    CASE ls_column-id.
    WHEN 'VBELN'.
    lo_column->set_position('1').
    WHEN 'MATKL'.
    lo_column->set_position('2').
    WHEN 'POSNR'.
    lo_column->set_position('3').
    WHEN 'MATNR'.
    lo_column->set_position('4').
    ENDCASE.
    ENDLOOP.
    ENDMETHOD.
    Hope this helps you to resolve your issue.
    Thanks
    KH

  • I purchased a monthly subscription to PS and LR two months ago, but still cant download any of it to my computer. got an error, but now its completly undownloadable.

    so after purchasing, i was unable to download it to my computer so i tried it on my wifes computer, it worked on hers, but i cant get my purchased programs on it, only the trial versions. so im stuck. I have LR4.2 on my computer but it wont view my .NEF files from my Nikon D610. so now im really irritated that i cant use anything that i have purchased from Adobe.

    Egman702 please utilize the steps listed in Sign in, activation, or connection errors | CS5.5 and later to resolve the connection error preventing your membership from being authorized.

  • Is it possible to have sorting by group and checkboxes in the same ALV

    Hi there,
    Does anyone know whether it is possible to have sorting and group on one field in ALV and checkboxes set on another field in ALV?
    eg.
    Fieldname
    ===========
    Name----
    Text
    Allowance----
    Numeric -> Sort & Group
    Verified----
    Checkbox
    How do I code it if it is possible to have grouping and check box all in one ALV.  Meaning I want some data that are the same to merge using sort, while still having the checkbox available for my other field (Verified).
    Thanks in advance.
    Lawrence

    hi,
    GROUP BY clause is used on database tables with select statement.
    sort is used on internal tables.
    can u clearly explain y u need group by and sort on the same field.
    if u are extracting from dbtable using grou by clause on a field, then no need to sort it again.
    if u want sort u can do it by giveing "sort itab by field". thats not a problem.
    now coming to check box.instead of using SLIS type field catalog, u use LVC type.
    in LVC_S_LAYO, u can fine box_fname.
    while defining layout, u declare a variable of type LVC_S_LAYO
    AND GIVE BOX_FNAME = internal table field name

  • Query takes time to execute. Review this query and give me a possible quere

    SELECT DISTINCT A.REFERENCE_NUMBER
    FROM A,B,C
    WHERE DF_N_GET_CONTRACT_STATUS (A.REFERENCE_NUMBER, TRUNC (SYSDATE)) = 1
    AND ( B.CHQ_RTN_INDICATOR IS NULL AND B.CHALLAN_NUMBER IS NULL
    AND C.INSTRUMENT_TYPE IN (1, 2) AND C.MODULE_CODE = 5 )
    AND ( A.HEADER_KEY = B.HEADER_KEY AND C.HEADER_KEY = B.HEADER_KEY);
    This query takes 3 minutes to execute. I want to improve the performance so that it can execute with in seconds.
    Table A has 10 lakhs record.
    Table B has 3.7 lakhs record.
    Table C has 5.3 lakhs record. Consider DF_N_GET_CONTRACT_STATUS as function. REFERENCE_NUMBER is the type of Varchar2(20).
    Plz give me a correct logical and fastest execution query for the same.
    Thanks in advance.

    I would agree with the post from Santosh above that you should review the guidelines for posting a tuning request. This is VERY important. It is impossile to come up with any useful suggestions without the proper information.
    In the case of your query, I would probably focus my attention on the function that you have defined. What happens if the condition using the DF_N_GET_CONTRACT_STATUS function is removed? Does it still take 3 minutes?
    SELECT reference_number
    from (
      SELECT DISTINCT A.REFERENCE_NUMBER
      FROM A,B,C
      WHERE ( B.CHQ_RTN_INDICATOR IS NULL AND B.CHALLAN_NUMBER IS NULL
      AND C.INSTRUMENT_TYPE IN (1, 2) AND C.MODULE_CODE = 5 )
      AND ( A.HEADER_KEY = B.HEADER_KEY AND C.HEADER_KEY = B.HEADER_KEY)
    where DF_N_GET_CONTRACT_STATUS(reference_number, trunc(sysdate)) = 1;Of course, the query above really depends on the cardinality of the returned data..... which is impossible to know without following the posting guidelines. This query could return anywhere between 0 rows and 2x10^17 rows. And in the latter case evaluating the function at the end wouldn't make any difference.
    Also, do you really need the distinct? Does it make any difference? Most of the time that I see distinct, to me it either means the query is wrong or the data model is wrong.

  • Group by Month, Group By Year

    I have a date column in my table and it looks like 2009/06/29. Is there a way I can GROUP BY MONTH and GROUP BY YEAR on this column?
    Or do I have to create a YEAR column to GROUP BY YEAR, and a month column to GROUP BY MONTH?
    Thanks.

    When you insert a group on date field you will be having an option in group option "The section will be printed" For each month or year. So you can select for each month or week or quarter or year.
    Regards,
    Raghavendra

Maybe you are looking for

  • Trying to install update-not working

    I am trying to install the new iTunes update and getting nowhere.  I click on dowload update and nothing happens.  I have tried quitting iTunes and restarting my compuer to no avail.  iTunes is acting a mess, keeps freezing my syncs and stops song pr

  • How do I text on my ipad mini with data

    How do I text with an ipad mini.  I have a data plan and want to text other platforms as well as iPhones.

  • Login Details

    I need to find the IP address who are all connecting to the database thru application or sqlplus

  • Help...My MacBook won't restart after the snow leopard 10.6.6 update

    Hi Guys, Really need some help, I have just updated from OSX 10.6.5 to 10.6.6 and upon restarting I am now presented with a MacBook that won't stop beeping and is stuck on a grey screen. Has this happened to anyone else and what's your suggestions to

  • Editing in PSE6 from lr3.3

    Newish laptop HP notebook w i3 Core processor & lots of storage, & Win 7, and brand new LR3.3 Set up CSE6 as external editor in preferences Select 1 pic in Library, call for editing, my Elements editing screen appears, annoying spinning circle appear