Qualified list item based on two columns

- fact table inludes following columns
key1
key2
measure1
In segment designer, update counts:
the query must counts two columns "key1 and key2" that key1 and key2 together must be distinct.

Here you go:
SQL> WITH bill AS
  2  (
  3          SELECT 1000 AS billno, 101 AS advertiserid, 102 AS agencyid, 5000 AS total_value FROM DUAL UNION ALL
  4          SELECT 1001, 101, 103, 5000 FROM DUAL UNION ALL
  5          SELECT 1002, 101, 102, 1000 FROM DUAL
  6  ), account AS
  7  (
  8          SELECT 101 AS account1_id, 102 AS account2_id, 'John' AS name, 50 AS empid FROM DUAL UNION ALL
  9          SELECT 101, 103, 'James', 40 FROM DUAL UNION ALL
10          SELECT 101, 105, 'Joe', 60 FROM DUAL
11  )
12  /* End Sample Data */
13  SELECT a.name
14       , a.empid
15       , a.account1_id
16       , a.account2_id
17       , SUM(b.total_value)
18  FROM   account a
19  JOIN   bill    b ON  a.account1_id = b.advertiserid
20                   AND a.account2_id = b.agencyid
21  GROUP BY a.name
22         , a.empid
23         , a.account1_id
24         , a.account2_id
25  ;
NAME                 EMPID          ACCOUNT1_ID          ACCOUNT2_ID   SUM(B.TOTAL_VALUE)
John                    50                  101                  102                 6000
James                   40                  101                  103                 5000

Similar Messages

  • Workflow to grant access to each List item based on a column value

    Hi,
    I have 2 lists Risks and RisksLookup.
    In Risks, I have Title, Description, service impacted and status columns.
    In RisksLookup, I have service impacted, AD1, AD2, AD3, AD4 and AD5.
    I have a requirement where in I have to write a Workflow to provide access to each List item based on the value of service impacted. i.e. If service impacted in Risks List is Client A, I have to lookup what all AD groups are present for Client A in RisksLookup
    List and provide access to only those groups for that item.
    Regards, Shreyas R S

    Hi
    another approach
    create 5 more lists, dedicated to each impacted service. for  Each one these lists apply needeed right ( based onAD groups )Keep you main list where first level will add new items . Attach a workflow to this main list, which will start when an item
    is added and which will add specific item's value to his new list ( based on impacted service value )
    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

  • CAML Query to Sort SharePoint list items based on Modified date

    hi ,
    can we sort sharePoint list items based on 'Modified' column, the sorting should be done up to milliseconds level.
    currently i am using CAML query as below
    <OrderBy><FieldRef Name='Modified' Type='DateTime' IncludeTimeValue='TRUE' Ascending='False'/></OrderBy>but its not considering milliseconds while sorting.
    Thanks and Regards,
    venkatesh.

    Veda, thanks but I'm not really a hardcore C# coder.
    We found more elegant solution was to create a List View which returns all records that should be deleted, based on our own custom deletion criteria, and then create an very simple SSIS Package in Visual Studio using the
    Sharepoint Connectors for SSIS to delete all Sharepoint List Items returned from that List View. The Sharepoint Destination Connector has a delete operation.
    This worked for us and didn't require any coding.

  • Populate the values  to  list item based on a check box

    Hi,
    How can i populate the values from a field on the form to one list item based on a check box,
    the pseudo code is like,
    if checkbox = checked then
    populate the particular field value to the list item;
    checkbox = unchecked;
    next_record;
    end if;
    Thanks
    Bcj

    To populate a Tlist item, do the following:
    1. Create a TLIST item in the EMP block. and give it a height to accommodate several names.
    2. Using the TLIST property pallete:
    a. Set the Column Name property to EMPNO
    b. Click on the Elements in List property. Delete each List Element and delete each List Item Value. If you don't do this you will get an error when you compile.
    3. Create a record group using this query:
    select ename, to_char(empno) from emp
    4. Create a WHEN-NEW-FORM-INSTANCE trigger, and place this code inside the trigger:
    Declare
    err_num number;
    Begin
    clear_list('YOUR_TLIST');
    err_num := populate_group('YOUR_RECORD_GROUP');
    If err_num = 0 Then
    populate_list('YOUR_TLIST', 'YOUR_RECORD_GROUP');
    Else
    message('Error populating Tlist');
    message('Error populating Tlist');
    End If;
    End;
    5. Compile and run the form. The ENAMEs will appear in the TList, and each ENAME will have a value equal to its EMPNO.

  • How to implement tooltip for the list items for the particular column in sharepoint 2013

    Hi,
    I had created a list, How to implement tooltip for the list items for the particular column in SharePoint 2013.
    Any help will be appreciated

    We can use JavaScript or JQuery to show the tooltips. Refer to the following similar thread.
    http://social.technet.microsoft.com/forums/en/sharepointdevelopmentprevious/thread/1dac3ae0-c9ce-419d-b6dd-08dd48284324
    http://stackoverflow.com/questions/3366515/small-description-window-on-mouse-hover-on-hyperlink
    http://spjsblog.com/2012/02/12/list-view-preview-item-on-hover-sharepoint-2010/

  • Update column based on two columns

    Hi,
    MinValue     MaxValue    Desc
    -1                -1    
    -1                 1    
    -1                 2    
    0                  0    
    0                  1    
    0                  2 
    The above is my table which is having three columns MinValue, MaxValue, Desc. First two columns have data and I need to update the 3rd column 'Desc' based on two columns data.
    I need to update like,
    when MinValue=-1 and MaxValue=-1 then 'NotSpecified'
    when MinValue=-1 and MaxValue=1 then 'Up to 1'
    when MinValue=-1 and MaxValue=2 then 'Upto 2'
    when MinValue=0 and MaxValue=1 then 'At lest 1'
    when MinValue=0 and MaxValue=2 then 'At least 2'
    when MinValue=0 and MaxValue=3 then 'At least 3'
    The data in 'MaxValue' is like 1,2,3,4,5...50. So for each description it should append this value as mentioned above(till 'Up to 50', 'At least 50'). How can I do this with case statement?
    Thanks,
    Gangadhar

    declare @T table ( MinValue int,MaxValue int, [Desc] nvarchar(100) );
    insert @T ( MinValue, MaxValue )
    values ( -1, 1 ) , ( -1, 1 ) , ( -1, 2), ( 0, 0), ( 0, 1), ( 0, 2)
    select *
    from @T
    update @T
    set [Desc] = case
    when MinValue=-1 and MaxValue=-1 then 'NotSpecified'
    when MinValue=-1 and MaxValue=1 then 'Up to 1'
    when MinValue=-1 and MaxValue=2 then 'Upto 2'
    when MinValue=0 and MaxValue=1 then 'At lest 1'
    when MinValue=0 and MaxValue=2 then 'At least 2'
    when MinValue=0 and MaxValue=3 then 'At least 3'
    end
    select *
    from @T
    T-SQL Articles
    T-SQL e-book by TechNet Wiki Community
    T-SQL blog

  • Sorting based on two columns in report

    Hi,
    we have one issue on sorting based on two columns in report.
    In the report we are doing sorting on two columns(week_id and stage_name). I have attached the screen shot for the same. The sorting is first done on the week_id and then on the stage_name. The issue comes when we have no data for the stage 1 - Prospect in W1. The stage goes to the second position.
    Please suggest if there is any work around to show the 1 - Prospect stage in W1.
    Regards,
    Ambika Nanda.

    what is w1? where is screenshot? and is stage seoncd sort? if so what is the issue?

  • Display list items based on another list item

    Hi All
                I want to display the list item based on another list item, but its not working.
    This is my code:
    /*WHEN-NEW-FORM-INSTANCE*/---Its working.
    DECLARE
       rg_district   recordgroup;
       rg_name       VARCHAR2 (40) := 'district';
       vtemp         NUMBER;
    BEGIN
       rg_district := FIND_GROUP (rg_name);
       IF ID_NULL (rg_district)
       THEN
          rg_district :=
             CREATE_GROUP_FROM_QUERY (rg_name,
                                      'select dist,dist from district_mas'
          vtemp := POPULATE_GROUP (rg_district);
          POPULATE_LIST ('BLOCK3.DISTRICT', rg_name);
       END IF;
       END;
    */WHEN-LIST-CHANGED*/---Not working. Cannot populate the list based on the List
       DECLARE
       rg_branch   recordgroup;
       rg_name1     VARCHAR2 (1000) := 'branch';
       vtemp       NUMBER;
    BEGIN
       rg_branch := FIND_GROUP (rg_name1);
       IF NOT ID_NULL (rg_branch)
       THEN
          DELETE_GROUP (rg_name1);
          rg_branch :=
             CREATE_GROUP_FROM_QUERY
                ('rg_branch',
                    'SELECT branch FROM dist_branch WHERE district IN (SELECT DIST FROM DISTRICT_MAS WHERE DISTRICT ='
                 || :BLOCK3.DISTRICT
          vtemp := POPULATE_GROUP (rg_branch);
          POPULATE_LIST ('BLOCK3.BRANCH', rg_branch);
       END IF;
       END;
    Table:
    CREATE TABLE DISTRICT_MAS
      DIST  VARCHAR2(100 CHAR)
    CREATE TABLE DIST_BRANCH
      DISTRICT  VARCHAR2(100 CHAR),
      BRANCH    VARCHAR2(100 CHAR)
    Values:
    insert into district_mas values('chennai');
    insert into district_mas values('coimbatore');
    insert into dist_branch values('chennai','chennai_north');
    insert into dist_branch values('coimbatore','Podanur');
    Regards
    Shagar M

    Hmm, not tested.
    try this..
    --*/WHEN-LIST-CHANGED*/
       DECLARE
       rg_branch       recordgroup;
       rg_name1     VARCHAR2 (1000) := 'branch';
       vtemp        NUMBER;
       QT            VARCHAR2(10) :='''';
    BEGIN
       rg_branch := FIND_GROUP (rg_name1);
       IF NOT ID_NULL (rg_branch)
       THEN
          DELETE_GROUP (rg_name1);
          rg_branch :=
             CREATE_GROUP_FROM_QUERY
                ('rg_branch',
                    'SELECT branch FROM dist_branch WHERE district IN (SELECT DIST FROM DISTRICT_MAS WHERE DISTRICT ='
                 || QT||:BLOCK3.DISTRICT||QT||')'
          vtemp := POPULATE_GROUP (rg_branch);
          POPULATE_LIST ('BLOCK3.BRANCH', rg_branch);
       END IF;
    END;
    Hope this works..
    Hamid

  • Filter list items based on security groups o365

    How to filter list items based on security groups in o365.

    Hi,
    According to your description, my understanding is that you want to filter list items based on the Office 365 security groups.
    If that is the case, I suggest you can create a data view to filter the list items with CAML Query like below:
    <Where>
    <Membership Type="CurrentUserGroups">
    <FieldRef Name="VisibleToGroup"/>
    </Membership>
    </Where>
    For more information, please refer the detailed article below:
    SharePoint - Filtering a View by Group Membership
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Want 2 populate value in 2nd list item based on value selected in 1st list?

    Want 2 populate value in 2nd list item based on value selected in 1st list?

    Gaurav -
    The 3rd list will not populate because nothing has been selected yet in list 2. The value in list 2 is null, so the loop to populate list (3) has nothing to load. Try the following below. This should seed your 2nd list so the 3rd list will populate.
    You will have to declare first_record boolean and first_value to match DESCC.
    first_record := true; -- NEW *****
    Clear_List('BLOCK2.ITEM2');
    FOR CurRec IN (SELECT UNIQUE DESCC DESCC FROM LUTT where LUTT.IDD = :BLOCK2.ITEM1)
    LOOP
    if first_record = true then -- NEW SECTION *****
    first_value := CurRec.DESCC;
    first_record := false;
    end if;
    Add_List_Element('BLOCK2.ITEM2',1,CurRec.DESCC,CurRec.DESCC);
    END LOOP;
    :block2.item2 := first_value; -- NEW *****
    Clear_List('BLOCK2.ITEM3');
    FOR CurRec2 IN (SELECT UNIQUE DESCC DESCC FROM LUTT where LUTT.DESCC = :BLOCK2.ITEM2)
    LOOP
    Add_List_Element('BLOCK2.ITEM3',2,CurRec2.DESCC,CurRec2.DESCC);
    END LOOP;
    My name is Ken, 1990 is when I started using Oracle Forms 3.0, character based in the Unix environments. And you are very welcome.

  • Update a list item based sort order of created by column value

    HI
    using powershell script how to sort a list column before update a list  item.
    here i created a document library and uploaded some documents and update ProcessNo column based sort order of created column
    value.
    Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
    $webURL = "http://tspmcwfe:91" $listName = "Courts"
    Get the SPWeb object and save it to a variable
    $web = Get-SPWeb $webURL
    $list = $web.Lists[$listName] 
    $items = $list.items
    Go through all items
    foreach($item in $items)
    $item["ProcessNo"] = 1
    $item.Update()
    $web.Dispose()

    Hi,
    According to your description, my understanding is that you want to sort the list items order before updating items using PowerShell.
    I suggest you can use the Sort-Object command to sort the list items.
    Here are some detailed articles for your reference:
    Better SharePoint Lists and List Items in PowerShell
    Sort-Object
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Listing Items based on criteria e.g. High Priority Items First.

    Hi,
    One of our customers have a need to List High Priority Items first on the WebTools site.
    Let's take two ItemCodes for example: Printer001, and, Monitor001.
    >> If these two items are included in the same category then Monitor001 will appear before Printer001 as WebTools sorts in alphabetic ascending order;
    >> But, our customer wants Printer001 to appear before Monitor001 as it is an Item higher in priority that Printer001.
    I can think of two possible solutions:
    1/2) Prefix Items with a number or letter to have it appear first in the WebTools default sort order. E.g. Rename "Monitor001" as "AMonitor001". This will not be possible for existing Items in SAP, so it doen't solve the issue,
    Or,
    2/2) Customize the Default WebTools Item List block to sort Items based on a User Define field called "pririty". Which might require a lot of effort.
    Please advise if anyone else has solved similar issue and how.
    Thanks very much for your replies in advance.

    Hey Kafil ... I think you may be stuck modifying the parts list page or creating something from scratch. I'm not aware of an easy way to do this out of the box.

  • Retrieve List Items based on condition in Where Clause

    Hello Experts,
     I am trying to retrieve list items from a list (CityList)  which contains 2 columns one is city(string) and State(Lookup) based on Lookup value, but i am getting all city names.
    here is my query below.
    function MainFunction() {
            var lookupid = 5;
            var myQueryString = "<Where><Eq><FieldRef Name='State' LookupId='true' /><Value Type='Lookup'>"+lookupid+"</Value></Eq></Where>";
            var myContext = new SP.ClientContext.get_current(); ;
            var myWeb = myContext.get_web();
            var myList = myWeb.get_lists().getByTitle("CityList");
            var myQuery = new SP.CamlQuery();
            myQuery.set_viewXml(myQueryString);    
            myItems = myList.getItems(myQuery);
            myContext.load(myItems, 'Include(Title)'); 
            myContext.executeQueryAsync(Function.createDelegate(this, GetListDataSuccess), Function.createDelegate(
    this, GetListDataFail));
        function GetListDataFail(sender, args) {
            // Show error message
            alert('GetListDataFail() failed:' + args.get_message());
        function GetListDataSuccess(sender, args) {
            var currListItemCount = myItems.get_count();       
            var currItemEnumerator = myItems.getEnumerator();
            var currItemDetails = '';       
            while (currItemEnumerator.moveNext()) {          
                var currItem = currItemEnumerator.get_current();          
                 currItemDetails = currItemDetails + ';' + currItem.get_item("Title");
            // Show details 
            alert(currItemDetails); 
    Please suggest where i am wrong. 
    Thank you
    saroj

    You need to enclose the <Where> tag inside <View><Query> . Try like below
    var myQueryString = "<View><Query><Where><Eq><FieldRef Name='State' LookupId='TRUE' />
    <Value Type='Lookup'>"+lookupid+"</Value></Eq></Where></Query></View>";
    Geetanjali Arora | My blogs |

  • BC4J Objects with PKs based on two columns using multiple sequences

    I have implemented a BC4J object that is based on a DB table that has two columns as the primary key. For example Table A's primary key is Group and ID and there is a DB sequence for each Group.
    I use the BC4J object using servlets and JSPs and I have been able to implement an Update form.
    I now want to implement a Create (New) form. I've read forum postings and info on the help regarding using the SequenceImpl class to override the EntityImpl object's create method as shown below:
    protected void create(AttributeList attributeList)
    super.create(attributeList);
    SequenceImpl mySeq = new SequenceImpl("MY_SEQ",getDBTransaction());
    setMyObjectId(mySeq.getSequenceNumber());
    But as you can see I need to know the value of the group attribute before I can get the next value sequence:
    For new EO belonging in Group1 I need sequence from "GROUP1_SEQ", Group 2 from "GROUP2_SEQ", etc.
    I would like to put this code in the Entity Object where it belongs. I guess my problem is simply how to create a new row in the View Object with a passed parameter which is the value of Group.
    Thanks in advance!

    Angelo:
    How is the EO suppose to receive the group id? Is it from the view row? If so, the VO can pass that group id to the EO through the attribute list and calling the
    public Row createAndInitRow(AttributeList nvp);
    API.
    Example code would be:
    ViewObject myVO;
    // myVO is initialized
    AttributeList nvp = new oracle.jbo.NameValuePairs();
    // GroupID is the attr name of the Group ID
    nvp.setAttribute("GroupID", <some-value>);
    Row row = myVO.createAndInitRow(nvp);
    If you do that the create(AttributeList attributeList) method of the EO will receive the GroupID value coming from the VO.
    Then, you can use that for your sequence.
    Thanks.
    Sung

  • Sharepoint 2010 List Item Stored in SQL - column optimalization

    Hi guys,
    I would like to ask you whether you know how are stored, optimalized or recalculated SQL tables where are sharepoint list items stored. I know that sharepoint has the limits how many text, number, boolean and datetimes columns can list item have to be stored
    on one row in SQL table. Let's asume this scenario: I have large list, more than 50 thousand items, and I have more columns in each item, so each item is stored on 3 rows in SQL table. When the list had few items, everything was smooth, now every operation
    with this list take too long so I would like to optimize the list. I can delete some unnecessary columns to satisfy the limits for storing items on one row in SQL table. Will it help to new added items? Will it help to old items which are already stored in
    list and are on 3 rows in SQL? Will be this items recalculated in SQL, or is there any option how can I manage this?? 
    Thanks for your ideas, any help would be appreciated

    Hello, thank you for you answer and interest in my problem. My list, isn't so small, it has about 180 columns and more than 50 000 items. I have taken this project after my friend who doesn't follow list recomandations and everything worked smooth around
    25 000 items, since than is working with the list rapidly slowing down. Now I need to optimize it. Yes i have increased lookup treshold and I know that queries aren't ideal, but I can not optimize them any more. And from your article I have more than 24 DateTime
    fields so I guess I am wrapping it to three lines. So I would like to delete some unnecessary colums at first and try to get to at least two lines, wheather it helps a bit. Dont worry, I wont modify the tables directly in SQL :-)

Maybe you are looking for

  • Re: BT can actually fix broadband faults! (no I'm ...

    Can anyone tell me how I get in touch with this chariman's office? It's been years and I have tried writing to the 'managing director' but not had a response. My next step i think in any case is the only one open to me: sending a bill for compensatio

  • ITunes just installed. wont open. but no message comes up to explain. ??

    i just installed itunes. when i go to open it the hourglass comes up. waits for a few secs then disappears and itunes never opens at all and no messages pop up. and also when windows shuts down a box pops up saying ending itunes. i tried changing the

  • Blue print for Purchasing

    Hi gurus Can I have some preconfigured project blueprint with name of reports ( specific to purchasing ) to understand my current assignment more efficiently? Thanks

  • Spry 1.6 for commercial use

    Hi, Can I use the Spry 1.6 prerelease for commercial use? Spry seems like The BSD license. However, the adobe labs license claims quote: IF THE SOFTWARE IS A PRE-RELEASE VERSION, then, notwithstanding anything to the contrary included within a licens

  • Connection issue: missng connection.xml

    Hi I downloaded sqldeveloper 3.0.0.3.97 for window I unzip it in a folder and I double click the sqldeveloper.exe When I try to connect to the database it gives me this error: Any help?? My Toad and sqlplus works fine. Failed to create naming Context