Sorting mechanism in OPA rules

Hi All,
I have few attributes at a person entity level in my data model.
My requirement is to pick #3 oldest people from the household based on age attribute.
How do we implement Sorting mechanism in OPA? If we can perform sort, then how to pick first/last n records out of it?
Please advise.
Regards,
Mohan

Thanks Matt for the information you shared.
I have a scenario like:
lets say a family has 5 children of different ages (Bob-18, Mary-18, Jane-17,Steve-20,Charlie-20) and I need to catch the oldest 3 members but not all. so in this scenario, i need to get output like Charlie, Steve and (either Bob or Mary )
Assume all are siblings. I created few inferred relationships (although they doesnt sound good ).
"the person" is a text attribute and an identifying attribute to the person entity.
the person's id is a number attribute.
the person(the other person) is a member of the person's next elder members if
the other person is not the person and
the other person is a member of the person's siblings
I'm getting logical issues for the below rule: reason: multiple values are getting returned in the third conditoin
the person(the other person) is a member of the person's  preferred elder member if
the other person is a member of the person's next elder members and
the other person's age = the greatest of the person's age for all of the person's next elder members and
the other person's id = the person's id which is the least for all of the person's next elder members for which it is the case that the person's age = the greatest of the person's age for all of the person's next elder members
If this issues gets fixed then, I need to pull oldest three members ?
I'm not getting enough points to write logic for RANKS. Can you assist me how to implement my requirement?
Also, do we have counters implementation in OPA like Counter=Counter+1?
Please share your inputs.
Regards,
Mohan

Similar Messages

  • Can we access two different Siebel BO in Same OPA Rule Base

    Hi all,
    can we access two different BO's from same rule base.
    what i means is,can we pass siebel data to OPA Rule Base from two different BO's .
    Thank you for your help in advance.

    There are two approaches to do this and they both involve making some small changes on the Siebel side.
    You can create an Integration Object which contains all the business components that you want to send to OPA if you are using an Integration Object mapping.
    If you would prefer to use a Business Object mapping then you will have to create a new Business Object which combines the BCs of all the Business Objects that you want to send to OPA.
    As you can see, although one approach involves Integration Objects and one involves Business Objects they both work by creating a single object which is an amalgamation of the information that you want to send to OPA.
    Cheers
    Frank

  • Nature of OPA rules - Static or Dynamic?

    Hi,
    In OPA, do we have an option of updating or choosing attributes (conclusions/conditions) or attribute values dynamically from any data source or application? I just want to know if such a provision is there or it is a manual activity all the time ... Kindly lay the info clearly for me throwing some light on any usecase.
    Best Regards,
    CC

    The best option is to pass all the data to OPA that it needs to make a decision. You can also get an "indecision" report that describes what additional data is needed to reach a decision. That data can then be obtained by the calling application and provided on the subsequent call to OPA.
    If you want to read data dynamically within a rule, rather than pass it in to OPA, you'll need to implement a custom function, and call it using CallCustomFunction. Search in the developer help for how to do this.
    * That custom function should be deterministic, at least within a session - i.e. it should always return the same data, given a particular customer ID, for example.
    * You also should NOT modify any attribute data directly within a custom function - only do this by assigning the value returned from the custom function directly to an attribute.
    In future versions, we plan to simplify the reading or modifying of entity/attribute data within a single round-trip to OPA.
    Davin Fifield

  • Sorting members using Load Rule Parent Child Method

    Hi all,
    I have a Product Dimension with around 7 gen's and wanted to sort Gen 3 members under parent (say CommProduct). All these members are initially loaded using Studio and i am trying sort Gen 3 members using a text file / Load Rule (Parent Child Method). I have "Allow Moves" ,"Allow Property Changes" and member sorting: None checked for the load rule. I tried updating the outline using the load rule, however the outline remains unchanged and members sorted by alphabets.
    Essbase Version: 11.1.2.3
    Current Hierarchy:
    Product 
               CommProduct
                                     A
                                     B
                                     C
                                     D
                                     E
    Hierarchy Wanted:
    Product 
               CommProduct
                                     A
                                     C
                                     E
                                     B
                                     D
    Dim Build Text File:
    Parent,Child,Aggregation
    CommProduct,A,+
    CommProduct,C,+
    CommProduct,E,+
    CommProduct,B,~
    CommProduct,D,+
    Any help would be highly appreciated.
    Thanks

    Can't you create a column where you can specify the desired order and build accordingly. I don't think you can achieve that using a load rule. Allow moves works only if the members are under a different parent. In your case it is the same parent.
    Regards
    Celvin
    http://www.orahyplabs.com

  • Sort out the Mail Rules

    How can I sort the mail rules, say by Description or by name.
    I have a lot of them and they are sorted by the time I added them.
    I KNOW you can sort them manually, but surely there has to be a way to sort them by a click of a mouse, or a script or something.
    Thanks

    Whilst it may not be your fault I am afraid it appears that your post is on a forum which is not the best for your OS. It will save the time of the unpaid volunteers here, and may resolve your issue faster, if you could examine the list below and see if there is a more appropriate forum to which you could direct your question.
    OS X 10.9 Mavericks
    OS X 10.8 Mountain Lion
    OS X 10.7 Lion
    OS X 10.6 Snow Leopard
    OS X 10.5 Leopard
    OS X 10.4 Tiger
    OS X 10.3 and earlier
    OS 9, OS 8 & System 7
    OS X Technologies
    OS X Server
    iPad
    iPhone
    iPod
    Other

  • Sort order from NAT rules via CLI

    Hi all,
    im a newbie here and i have my first question. Hope you can help me to find a solution.
    Is there a way to change the order of NAT statements via CLI in Cisco ASA IOS 9.1 ?
    By ASDM i can change the order and bring them up and down to the place where i must have them, but i found no way to do this via CLI.
    Any Ideas?
    Greetings from germany
    Marco

    You would need to remove the NAT statements and then re-add them in the order you want them to appear.  The ASDM does it the same way but makes it easier by you just having to move the NAT rule to where you want it and apply...the ASDM does the rest.  If you set your ASDM to show the commands before they are applied you will see how the ASDM does this.  The setting is under Tool > Preferences and select Preview commands before sending them to the device
    Please remember to select a correct answer and rate helpful posts

  • Dimension build rule file (Sort member)

    I am loading sorted data for one of the dimension. But its is not coming in sorted fashion in outline. New member which i am adding is always coming in The end.Even though that member is in sorted format in the file.
    I am using generation method . I am putting member for only generation 2 and its alias.I tried using ascending option but it is giving me error
    Can any body help me with this

    As Glenn said, the build only builds new members. In order to have FULL control over the order of a resultant dimension's order, you need to blank out the dimension first and then build via the load rule. As Glenn mentioned, you can do "incremental dimension building". You can do this directly in EAS in an interactive manner by using outline/update outline in pull downs. Just do not save the outline until all your changes are done. You can also accomplish incremental builds via Esscmd or via MaxL, but I'll assume for right now you are still testing. The advantages of the incremental changes is that you can do a number of changes before Essbase commits to doing a restructure, which is time consuming, not to mention confusing if you are "deleting" (however temporary) the entire dimension's hierarchy.
    Regarding setting ascending order
    1) in the load rule's Dimension Build Settings prompt
    2) Select Dimension Build Settings tab
    3) highlight the dimension you are changing
    4) select Ascending for sort order
    This should work...I've never had it error out. However, I will say that it sorts the entire dimension...not just the siblings of a new member. Your upper level members will move as well. Because of this, the ascending sort in a load rule is undesirable. Give it a try. If you don't like the results, just don't save the outline.
    Kevin

  • Program with Mail Rule script

    I am trying to develop a Mail run script and I am running into problems. The Rule is being trigger because I have a change my color rule action and a script action. The color changes but the script does not appear to trigger at all. His is the script.
    using terms from application "Mail"
    on perform mail action with messages theMessages
    tell application "Finder" to set pathToAttachments to (path to desktop folder as string)
    tell application "Mail"
    repeat with theMessage in theMessages
    set theText to content of theMessage
    if theMessage's mail attachments is not {} then
    repeat with theAttachment in theMessage's mail attachments
    set theFileName to pathToAttachments & theAttachment's name
    try
    save theAttachment in theFileName
    on error errnum
    end try
    tell application "Preview" to open file theFileName
    tell application "Finder" to delete file theFileName
    end repeat
    end if
    end repeat
    end tell
    end perform mail action with messages
    end using terms from
    tell application "Mail"
    set myMessages to selection
    tell me to perform mail action with messages myMessages
    end tell
    Notice the tell block at the end. If I uncomment that, select a mail message and execute that in a script editor, all is fine.
    With that block commented out and try to execute it using the *Apply Rules* nothing seems to happens. Even if I put a Beep statement inside the "on perform mail action with messages theMessages" block, That does not even sound off.
    Anyone see why this would execute as a rule?

    Camelot wrote:
    The logic of whether to invoke the rule is not within the script.
    You tell Mail.app to run the script when certain conditions are met (e.g. sender address, recipient address, or one of several other conditions). Once Mail.app has decided the messages matches the conditions it calls your script.
    I realize that is the theory behind mail.app, but it has been my experience with Rule settings that they do NOT run "automagically" when conditions in them are met.
    This is clearly illustrated by a number of cases I have where by simply "adding a rule," any rule, that says anything, and then clicking the resulting "apply" button (which only is available when you add or subtract a rule), all the existing rule(s) are processed and mail is sorted according to those rules which had previously been sitting in the inbox. (In my case they are a bunch of "junk" filters).
    There is either some bug in mail's triggering mechanism, or some inherently "different" mechanism in use when "auto triggered" vs when "applied." In either case, there is no documentation about it.

  • Sort array list and using comparable

    With the following code I would like to setup a score object for the current player.
    Change it to a string(Is it correct to say parse it to a string type)
    Then add it to the arraylist.
    So I can sort the array list according to the string size.
    That's why I have the variables in that order.
    So if 3 players have the same amount of guesses, they can be positioned on the high score list according to their gameTime.
    //create score object
                   Score currentScore = new Score(guessCount, gameTime, name);
                   String currentScoreToString = currentScore.toString();
                   //add score to arrayList
                   scores.add(currentScoreToString);So the error message says " The method add(Score) in the type arrayList <Score> is not applicable for the arguments(string)"
    Now, I understand that, I would like to know if there is another way to achieve what I am trying to do.
    Is the string idea I am trying here possible? is it practical or should I use comparable?
    I have looked at comparable, but I don't get it.
    Will my Score class implement comparable. I am looking at an example with the following code.
    Employee.java
    public class Employee implements Comparable {
        int EmpID;
        String Ename;
        double Sal;
        static int i;
        public Employee() {
            EmpID = i++;
            Ename = "dont know";
            Sal = 0.0;
        public Employee(String ename, double sal) {
            EmpID = i++;
            Ename = ename;
            Sal = sal;
        public String toString() {
            return "EmpID " + EmpID + "\n" + "Ename " + Ename + "\n" + "Sal" + Sal;
        public int compareTo(Object o1) {
            if (this.Sal == ((Employee) o1).Sal)
                return 0;
            else if ((this.Sal) > ((Employee) o1).Sal)
                return 1;
            else
                return -1;
    ComparableDemo.java
    import java.util.*;
    public class ComparableDemo{
        public static void main(String[] args) {
            List ts1 = new ArrayList();
            ts1.add(new Employee ("Tom",40000.00));
            ts1.add(new Employee ("Harry",20000.00));
            ts1.add(new Employee ("Maggie",50000.00));
            ts1.add(new Employee ("Chris",70000.00));
            Collections.sort(ts1);
            Iterator itr = ts1.iterator();
            while(itr.hasNext()){
                Object element = itr.next();
                System.out.println(element + "\n");
    }The thing I don't understand is why it returns 0, 1 or -1(does it have to do with the positioning according to the object is being compared with?)
    What if I only use currentScore in a loop which loops every time the player restarts?
    //create score object
                   Score currentScore = new Score(guessCount, gameTime, name);
                   String currentScoreToString = currentScore.toString();
                   //add score to arrayList
                   scores.add(currentScoreToString);Also why there is a method compareTo, and where is it used?
    Thanks in advance.
    Edited by: Implode on Oct 7, 2009 9:27 AM
    Edited by: Implode on Oct 7, 2009 9:28 AM

    jverd wrote:
    Implode wrote:
    I have to hand in an assignment by Friday, and all I have to do still is write a method to sort the array list. Okay, if you have to write your own sort method, then the links I provided may not be that useful. They show you how to use the sort methods provided by the core API. You COULD still implement Comparable or Comparator. It would just be your sort routine calling it rather than the built-in ones.
    You have two main tasks: 1) Write a method that determines which of a pair of items is "less than" the other, and 2) Figure out a procedure for sorting a list of items.
    The basic idea is this: When you sort, you compare pairs of items, and swap them if they're out of order. The two main parts of sorting are: 1) The rules for determining which item is "less than" another and 2) Determining which pairs of items to compare. When you implement Comparable or create a Comparator, you're doing #1--defining the rules for what makes one object of your class "less than" another. Collections.sort() and other methods in the core API will call your compare() or compareTo() method on pairs of objects to produce a sorted list.
    For instance, if you have a PersonName class that consists of firstName and lastName, then your rules might be, "Compare last names. If they're different, then whichever lastName is less indicates which PersonName object is less. If they're the same, then compare firstNames." This is exactly what we do in many real-life situations. And of course the "compare lastName" and "compare firstName" steps have their own rules, which are implemented by String's compareTo method, and which basically say, "compare char by char until there's a difference or one string runs out of chars."
    Completely independent of the rules for comparing two items is the algorithm for which items get compared and possibly swapped. So, if you have 10 Whatsits (W1 through W10) in a row, and you're asked to sort them, you might do something like this:
    Compare the current W1 to each of W2 through W10 (call the current one being compared Wn). If any of them are less than W1, swap that Wn with W1 and continue on, comparing the new W1 to W(n+1) (that is, swap them, and then compare the new first item to the next one after where you just swapped.)
    Once we reach the end of the list, the item in position 1 is the "smallest".
    Now repeat the process, comparing W2 to W3 through W10, then W3 to W4 through W10, etc. After N steps, the first N positions have the correct Whatsit.
    Do you see how the comparison rules are totally independent of the algorithm we use to determine which items to compare? You can define one set of comparison rules ("which item is less?") for Whatsits, another for Strings, another for Integers, and use the same sorting algorithm on any of those types of items, as long as you use the appropriate comparison rules.Thanks ;)
    massive help
    I understand that now, but I am clueless on how to implement it.
    Edited by: Implode on Oct 7, 2009 10:56 AM

  • Sort by different sets in the report

    Hi, I have a report requirement like.
    orders sorted by (set1)ch1, ch2, ch3, ch4.
    open quotes sorted by (set2)ch1, ch2, ch3, ch4, ch5, ch6, ch7.
    if the user selects orders, he should see only set1 fields
    if the user selects quotes, he should see set 2 fields.
    how do we do this?
    Thanks,
    Radha

    There is nothing you can pass user selection to sort mechanism. Bex or Web is not to that standard, but in the future it will have it. Sorry for now.
    thanks.
    Wond

  • Sorting of data in adobe forms

    Hi,
    We have an adobe form designed which picks the data from the backend. In one specific case, a table comprising of different headers with different data, including date is being called.
    My pdf simply displays the data, the way it is stored in the backend. But now I want to display the data, sorting by its date mentioned. Is it possible for the pdf to read the content of the data and display it based on the sorting defined on the layout end?
    I did come across the 'controls' option for the table(under context) and tried adding the field name for sorting based on ascending/descending. But unfortunately, whenever I tried to enter the field name as 'date', it gives me an error saying "component does not exist". I have tried for other fields too, but the same message. This message comes irrespective of the check box for 'already sorted' property.
    What could be the reason for this?
    In the code initialisation of the interface, I heard that there can be a sort mechanism being coded. Is this alternative possible in my case?
    Please provide your valuable inputs.
    Thanks

    You´d better sort the table in the backend (data does not change in the form, as you said, you can do that). If that is your program which prepares the data, change it, if that is a standard, find an exit or repair it or you can do that in the interface. You would maybe like to read my blog about the changes of forms: /people/otto.gold/blog/2010/05/06/how-to-deal-with-sap-standard-adobe-forms
    Otto

  • What sort order does address book use?

    I'm trying to be able to sort things "after" the alphabet in a standard address book "sort by name" sort order. So aA to zZ then other stuff. In a standard ASCII sort, ~ would work - but that's been changed in Thunderbird.
    So far I've been trying to find out what comes after "Z" in the sort order, but have been unable to do so.
    It's not following ANY standard sort order that I've been able to determine.
    It's sorting 0xF7 (÷) in front of 0x5A (Z). It's even sorting Unicode U+FEFC *before* U+005A in an "ascending" order??
    Was the standard sort order hacked so that anything that isn't alphabetical comes first, which means that if I want to have something sort after "Z" I HAVE to use zz or zzz instead of what works in every other program I use? Even ~ sorts before the alphabet, yet even in standard ASCII it sorts after.
    Anyone know of an add-on that fixes this "helpful" hack and gives me a predictable, dependable, and above all documented sort order?

    I think my only comment at this point can be "my, that escalated quickly!!".
    Thanks for the pointers and information. Unfortunately, I'm now lost in too much mostly incomprehensible information. However, the tr03.pdf doc you provided I think had the answer.
    If I understand it correctly, this (new to me) sorting mechanism means that nothing comes after Z any more? (based on the PDF file you gave me, part 3.0 intro, order of characters). Is that correct?
    Actually, I think I'd consider this "solved", or at least "answered".
    Thank you.

  • Report sort by column header question

    the column sort in a standard report (RP or Q) does sort the lower case values at the end of the alphabet; how can I integrate the lower case values in to the regular sequence of the alpha letters ?
    Example of desc order: it starts with lower case :
    ülog Company
    swa Company
    mobiler AG
    freezer.net
    dpa Company (*)
    ZKL Company
    Warner Music
    Victors
    United Internet
    Echo
    Dora Co.
    Charly
    Berta Co.
    ABC company
    - as I cannot influence the Sorting of the inbuilt sort mechanism - how can I manage to integrate e.g. dpa (*) between Echo and Dora Co. ?
    TIA
    Bernhard

    Bernhard,
    use the INITCAP() function for that column (a). Fetch the same column once again without
    using the INITCAP function and hide it (b). In the properties of the column a ==> HTML
    Expression enter #b# in order to display column b. This way the column will display the text
    as is (b) but sort on capital initial letters (a).
    However, using a standard report doesn't allow any modification of the columns within the
    query. There, you would need a view to query upon. Or you just use a "normal" report.
    Denes Kubicek

  • Sorting algorithm ?

    what is the sorting algorithm used in Collection.sort ?
    Its not clear what sorting algorithm is used in Collection.sort
    http://download.oracle.com/javase/1.4.2/docs/api/java/util/Collections.html
    Can anybody throw some light on this ?

    roy wrote:
    It works on binary search algorithm.No.
    Binary search requires that the list already be sorted. You don't use binary search to do the sorting.
    This algorithm has two forms. The first takes a List and an element to search for (the "search key"). This form assumes that the List is sorted in ascending order according to the natural ordering of its elements. The second form takes a Comparator in addition to the List and the search key.The second form also assumes the list is sorted--according to the rules of the comparator.

  • Is there any property in OPA for textbox - allow only numbers and hypen

    Hi,
    I am working in .net code with OPA rules engine. I have set of OPA screens with textboxes.I want to restrict the user to type only numbers and hypens for some of the text boxes(like phone no,ssn,zip code and so on).
    As you know,this can be done in .Net javascript/jquery.The problem is , we don't have any clue to identify which textboxes needs to be restricted(out of 25 textboxes in entire flow ,only 4 needs to be restricted). Currently,nly the idea we have based on the screen title and question(hard coding).But it's not the right solution.If the rulebase changed,it won't work.
    Is there any property/API in OPA end for textboxes to set to give some clue to front end developers(dotnet) not to allow other than numeric and hypen for these textboxes ? OPA developer has written some rules for this , but it will do the validation only after entering the value, we want to restrict the keyboard entry itself based on some property getting from OPA.
    Thanks.

    Thanks for your quick response, actually OPA developer added some regular expression to validate the textbox entry, as you said it's working properly after entering some values in textboxes.
    But, still i am looking to do the keyboard manual entry restriction in front end .NETcode based on some clue from OPA.I can understand keyboard entry restiction can't be done in OPA end. We use OPA rules engine to display the screens and textbox controls in front end .NET code.
    But if i get some clue from OPA ,like saying that,these are the textboxes having reg expression property for which you need to restrict only numbers and hypen.
    We have around 100 screens in the flow , out of which some of the screens have textboxes(out of that only few textboxes needs to be restricted only numbers and hypen) .
    Currently , i have some javascript code to restrict the keyboard entry ,but it's working common for all the textboxes, i want to restrict only few textboxes which should accept only numbers and hypens.If i get any property/clue from OPA, saying that this is the property for textbox for which you should restrict only numbers.
    Like , for example, multilinecount property for textboxes which should appear bigger. As of now,OPA developer doesn't have any clue about how to do this.
    Thanks,

Maybe you are looking for

  • Jabber Client on iPod Touch 5th Gen

    I'm running the Cisco Jabber client on an iPod Touch 5th Gen and running into an issue with call notification coming across when the jabber app is in background mode.  I get a repeating pulsing on the device and visual notification of a call being pr

  • Problems with Oracle XE on XP - Please help!

    Hi, I have oracle XE installed on my machine and it was working absolutely fine for the last year or so. Today there was an trojan intrusion which caused some issues with my windows xp OS like hiding some files, desktop etc. After everything was clea

  • Need to Add a new Field to FamAddPG

    Hi All, We are trying to add a new field Start Reason Id field in to a view object FamilyMembersVO. This field should be able to be entered and updated in the FamAddPG (oracle/apps/ben/selfservice/enrollment/webui/FamAddPG) . We were able to identify

  • Idoc not recive while sending using program & SEND IDOC IMMEDIATELY in we20

    <b>i am sending idoc using program</b> - with function master dat distribute function, now if i set SEND IDOC IMMEDIATELY in outbound message in we20 'partner profile' than idoc get status 03 but at reciver end idoc not found with any status. if sele

  • I want to give enable a button for a user and disable for others in tcode

    Hi all , I want to give authorisation based on user for TCODE : CCO02 where i enter Production Order. After clicking enter button in the next screen for the Total order quantity Icon i want to assign Authorisation to enable to one user and to set in