Sort ToyStore ShoppingCart rows?

Is it possible to specify an order by clause in a view object made up of only transient attributes that uses the pending state mgmt facility ?

Hi Sung,
Thanks for responding.
I’ve reviewed your in-memory / 2nd VO code, and I may end up using this approach. Thanks.
QUESTION: can an ‘all transient attribute VO’ (with ‘Enable Passivation’ and ‘For All Transient Attributes’ checked) be sorted ?
The 'pending state mgmt facility’ I mentioned is described in BC4J ToyStore doc.
Experimenting with State Management and Failover Support
This failover capability works because the BC4J framework offers automatic database-backed state management for pending data in your application. In the BC4J Toy Store application, the pending shopping cart information is not stored in the HTTP session state the way most applications do. Instead, with a declarative checkbox on the ShoppingCart component at design time, we indicate that we'd like this component's pending data to be managed for us. And the framework takes care of the rest.
The ShoppingCart VO has all transient attributes, and has a special connection, ‘toystore_statemgmt’ to handle this functionality.
PROBLEM: returns an empty VO when trying to sort, but is fine without sorting.
This problem occurs only with Transient view attributes VOs - Persistent view attributes VOs work fine.
Whether using the in-the-jsp DataTag / WebBean approach:
<jsp:useBean id="sbCart" class="coco.controller.wcsb.sbShoppingCart" scope="request" >
<% sbCart.initialize(pageContext); %>
</jsp:useBean>
<jbo:DataSource id="ds" appid="CocoService"
viewobject="ShoppingCart"
orderbyclause="<%= sbCart.getOrderByClause() %>" />
OR
the Struts Action jbo interface call
ViewObject cart = am.findViewObject(“ShoppingCart”);
cart.setOrderByClause(“vendor”);
the problem is the same: returns an empty VO when trying to sort, but is fine without sorting.
Any ideas ?
Thanks,
David

Similar Messages

  • How do I sort only selected rows?

    Hi, in Maverick, the option to sort only selected rows seems to be gone anyone out there who knows how to do this? Cheers Paull

    Hi SG,
    Firstly, I wasn't saying that Wayne's posts were rubbish, I said his comment about V2 not having sorts by rows was rubbish as I proved with my image. I am just really frustrated professional person who has been signing Apples and Numbers praises that has been left feeling really let down.
    Personally, I do not wan't an OSX version Numbers to be the same as the IOS version. My old IOS version was perfectly adequate as was my OSX vesrion. I'm not interested in doing this on my phone or iPad BUT when I am at work on my 27" iMac, I don't want to use a piece of software that is written to be more compatible with a mobile device so I couldnt care if the IOS version has a Reorganize panel.
    I'm saying that they (Apple) shouldn't dress this up as V3 of numbers. They should call it
    NUMBERS LITE COMPATIBLE WITH IOS DEVICES
    Which is really what it is, and then most of us who require a serious spreadsheet, wouldn't have bothered downloading it and wasted hours only to find out that it is not fit for purpose.
    The problem I have is that there will no longer be any improvements to V2 so this is now what we are stuck with with the only alternative being to return to Excel, which I hate with a vengence.
    Also, we are stuck with this version if we want to use sheets we create in OSX in our ipads. Once again, not even close to being acceptable.
    All in all, not what I expect from Apple, or is this just the type of thing we have to expect from them now.
    Spencer

  • Incorrect sort order of rows in Purchase Order based on Sales Order

    Hello Experts.
    I have this problem on SAP B1 8.81 PL 04:
    I create a Purchase Order based on a Sales Order with 10 item rows, ticking the purchase order box in the logistic tab.
    The sort order of rows is different between PO and SO.
    I need the same order of SO on PO.
    Is there something I can do or it's a problem of this patch?
    I saw the Sap Note nr. 824822 but it's related to SAP B1 version 2004 A...
    Regards
    Silvia Reggiani
    Edited by: Silvia Reggiani on Oct 11, 2011 12:26 PM

    Hi,
    Are you able to reproduce the issue in the DEMO Database on the 8.81 PL04?
    Also, have you checked the issue in the latest patch of the 8.81?
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Custom Sort of Duplicated row walues in Webi based on SAP BW Universe

    It is a duplicate thread i have already posted in Integration kits - SAP section.
    This is regarding custom sorting of row value which are duplicated in Webi which is based on SAP BW Universe.
    I have created Webi Report based on Characteristic structure. Using Alerter I provide some space for child node to notify it as child node below a parent node.
    Please see a sample table below:
    AAAA
    onpeak
    midpeak
    offpeak
    BBBB
    onpeak
    midpeak
    offpeak.
    If I enable Avoid duplicate row aggregation, i will be able to see duplicate rows for "onpeak" etc. Since Webi does a default sorting, I have to make a custom sort to replicate the structure followed. And in custom sort i dont see duplicated rows, and i see only one "onpeak". Accordingly if I try to sort using custom sort, then the result will be
    AAAA
    onpeak
    onpeak
    midpeak
    midpeak
    offpeak
    offpeak
    BBBB.
    Please let me know if anyone has any solution for this.
    I have already created report with modifying the row names in backend by adding letter before its value for example "1offpeak" for the duplicated row and then removing the letter "1" in webi using substring. But i know this is the crude way of doing it.

    I have changed the naming convention in BI structure by introducing a white space before the name to avoid duplication and used it in report. Not a good solution anyway.

  • Crosstab: Sort Descending by Row Total

    Good Morning,
    I've created a simple Crosstab that documents qty per CPT code for each of 3 reporting periods.  Currently, the crosstab sorts records by CPT code which is my only row field.  My column field is formula based on discharge date (3 separate reporting periods.  The data is Sum of Quantity field. 
    While the report is functional, I need to go one step further.  The user would like the report sorted on total quantity in descending order.  That is, the CPT with the highest grand total quantity is to be shown at the top of the report. 
    Can anyone suggest the best approach to solving this challenge?
    Thanks for your help!!

    Wow, That was quick and easy.
    Thanks for the help...I probably should have noticed that in the first place.

  • Sorting columns and rows

    I am incredibly frustrated, more and more, but what I find to be non-intuitive functions of this app. I have a long column of row headings (and column headings to be frank) that are in text. I want to sort them, along with the associated row.
    This should not be difficult, but it is impossible. I've been using spreadsheet programs from the first day they were available for the Mac, a billion years ago (give or take a couple of years). I'm starting to think that Numbers is one of the worst.
    Annoyingly, the help function, gives me no help. Can someone point me to the location of how to learn how to do a sort? Because I guess just right clicking on the column to sort is way to easy, like it was in the previous version of Numbers.

    Click on the right edge of a column heading to get:
    Sort & Fiilter Options (also via Table > Sort & Filter Options):

  • Sort view object rows with transient attributes

    Hi ,
    Is it possible to sort the results of a view object based on the populated transient attributes ?
    Best regards
    K

    K,
    Have you had a look at section 27.5 of the ADF Developer's Guide for Forms/4GL Developers ("Performing In-Memory Sorting and Filtering of Row Sets") - I've not tried it with transient attributes, but it does describe how to do in-memory sorting, as opposed to the normal way of sorting which is to send an ORDER BY to the database.
    Hope this helps,
    John

  • Sort by result rows

    hi all
    In my query I got several chars: Organization, Planning Level, Date
    And 3 key figures: Planned amount, Actual Amount, Plan/Actual (calculated KF)
    My query got results by Organization on Plan/Actual KF (totals are averages).
    Now I need to sort up all Organizations by Planning accuracy, in other words I need to sort query results by Plan/Actual KF totals based on Organization Level.
    I created Condition TOP 100 % on Plan/Actual KFG with setting "Individual Chars and Char combinations" and assigning Organziation. But it seems it doesn't work.
    How can I make this work?

    Thnx, Akshay, but I already done like you said and run into some strange behaviuor.
    Than I keep it far left without Date in rows it seems ALMOST working. "Almost" because it sorts all organizations well except the last one, which is bigger then first before last, like this:
    Org PLevel KFG
    111   15      100
    112   14         90  
    109   14         65
    115   12         30
    110   13         89
    Second, it doesn't work at all than I got Date in rows (doesn't matter Organization is far left or no)...
    Edited by: Gediminas Berzanskis on May 11, 2010 1:56 PM

  • Sorting JTab disables row selection

    In a scroll panel I inserted a Jtable that shows view data. Sorting works by double-clicking the column header. After sorting however rows cannot be selected, sometimes the table gets reorganized again.
    How can I allow a row to be selected after sorting as described above?
    Thank you.

    This is the way the sort model was designed. I filed an enahncement request.
    Frank

  • Sort by order rows were inserted

    Hi,
    How do I kow the rows order their were inserted in a table;
    Thanks
    HP

    You can only retrieve rows in the order of insertion if you populate a column with a date or sequence value (or combination) and then use that column(s) in the ORDER BY clause. ROWID is not an indicator of insertion order.

  • Please restore "reorganize: sort by selected rows" feature!

    I was using this feature frequently every day and now I'm told it is no long available! :/

    K.G.
    In this forum you are posting to fellow users like you.  Use the menu item "Numbers > Provide Numbers Feedback" to send your comments and feedback to Apple.

  • Cannot sort child rows in multilevel tree table

    Hi,
    I originally hijacked a two-year-old forum thread that was vaguely similar to my issue, but a kind forum moderator split my post away
    (and deleted my other hijack post asking this same question)
    so that my inquiry might be viewable on its own.
    Hopefully someone can pay attention to my issue instead of getting it confused with those other old forum threads.
    So, here we go ...
    Is sorting in a treeTable at a particular level possible? Just want to let you I have tried the following approaches to do this. But it dis not work for me.
    I have tree table with 2 levels. I am trying to sort the child rows based on its column say "Display Sequence".
    User can type in number in this column which contains input text. On value change event of the this field, all the
    child rows in the level 2 need to be sorted. This needs to be done without committing the data. On commit it works,
    because it sorts based on order by clause. I want the child rows to be sorted on value change event. Following
    various approaches I tried.
    TreeModel tModel = (TreeModel)treeTable.getValue();
    SortCriterion sortCriterion = new SortCriterion("DisplaySequence",true);
    List<SortCriterion> sortCriteriaList = new ArrayList<SortCriterion>();
    sortCriteriaList.add(sortCriterion);
    tModel.setSortCriteria(sortCriteriaList);
    The above code does not work, As "DisplaySequence" is not available in the parent view object.
    Here is approach no 2
    JUCtrlHierBinding treeTableBinding = null;
    JUCtrlHierNodeBinding nodeBinding = null;
    JUCtrlHierNodeBinding parentNodeBinding = null;
    JUCtrlHierTypeBinding nodeHierTypeBinding = null;
    Key rowKey;
    Object dispSeqObj;
    Number displaySequence = null;
    Map<Key,Number> keyValueMap = null;
    Set<Key> emptyValueKeySet = null;
    Map<Key,Number> sortedKeyValueMap = null;
    DCIteratorBinding target = null;
    Iterator iter = null;
    int rowIndex = 1;
    RowSetIterator rsi = null;
    Row currentRow = null;
    Row row = null;
    RowKeySet selectedRowKey = lookupTreeTable.getSelectedRowKeys();
    Iterator rksIterator = selectedRowKey.iterator();
    if (rksIterator.hasNext()) {
    List key = (List)rksIterator.next();
    System.out.println("key :"+key);
    treeTableBinding = (JUCtrlHierBinding) ((CollectionModel)lookupTreeTable.getValue()).getWrappedData();
    nodeBinding = treeTableBinding.findNodeByKeyPath(key);
    parentNodeBinding = nodeBinding.getParent();
    //rsi = nodeBinding.getParentRowSetIterator();
    rsi = parentNodeBinding.getChildIteratorBinding().getRowSetIterator();
    keyValueMap = new LinkedHashMap<Key,Number>();
    emptyValueKeySet = new LinkedHashSet<Key>();
    // Gets the DisplaySequence by iterating through the child rows
    while(rsi.hasNext()) {
    if(rowIndex==1)
    row = rsi.first();
    else
    row = rsi.next();
    rowKey = row.getKey();
    dispSeqObj = row.getAttribute("DisplaySequence");
    if(dispSeqObj!=null && dispSeqObj instanceof Number) {
    displaySequence = (Number)dispSeqObj;
    keyValueMap.put(rowKey, displaySequence);
    }else {
    emptyValueKeySet.add(rowKey);
    rowIndex++;
    rowIndex = 0;
    // Sort the numbers using comparator
    DisplaySequenceComparator dispSeqComparator = new DisplaySequenceComparator(keyValueMap);
    sortedKeyValueMap = new TreeMap<Key,Number>(dispSeqComparator);
    sortedKeyValueMap.putAll(keyValueMap);
    rsi.reset();
    nodeHierTypeBinding = nodeBinding.getHierTypeBinding();
    System.out.println("nodeHierTypeBinding :"+nodeHierTypeBinding);
    String expr = nodeHierTypeBinding.getTargetIterator();
    if (expr != null) {
    Object val = nodeBinding.getBindingContainer().evaluateParameter(expr, false);
    if (val instanceof DCIteratorBinding) {
    target = ((DCIteratorBinding)val);
    ViewObject targetVo = target.getViewObject();
    System.out.println("targetVo :"+targetVo);
    targetVo.setAssociationConsistent(true);
    //ri = target.findRowsByKeyValues(new Key[]{rowData.getRowKey()});
    rsi = parentNodeBinding.getChildIteratorBinding().getRowSetIterator();
    //rsi = nodeBinding.getParentRowSetIterator();
    // Rearrange the tree rows by inserting at respective index based on sorting.
    ViewObject vo = nodeBinding.getViewObject();
    iter = sortedKeyValueMap.keySet().iterator();
    while(iter.hasNext()) {
    currentRow = rsi.getRow((Key)iter.next());
    rsi.setCurrentRow(currentRow);
    rsi.setCurrentRowAtRangeIndex(rowIndex);
    //rsi.insertRowAtRangeIndex(rowIndex, currentRow);
    rowIndex++;
    iter = emptyValueKeySet.iterator();
    while(iter.hasNext()) {
    currentRow = rsi.getRow((Key)iter.next());
    rsi.setCurrentRow(currentRow);
    rsi.setCurrentRowAtRangeIndex(rowIndex);
    //rsi.insertRowAtRangeIndex(rowIndex, currentRow);
    rowIndex++;
    rsi.closeRowSetIterator();
    AdfFacesContext.getCurrentInstance().addPartialTarget(treeTable);
    private class DisplaySequenceComparator implements Comparator {
    Map<Key,oracle.jbo.domain.Number> dispSeqMap = null;
    public DisplaySequenceComparator(Map<Key,oracle.jbo.domain.Number> dispSeqMap) {
    this.dispSeqMap = dispSeqMap;
    public int compare(Object a, Object b) {
    Key key1 = (Key)a;
    Key key2 = (Key)b;
    oracle.jbo.domain.Number value1 = dispSeqMap.get(key1);
    oracle.jbo.domain.Number value2 = dispSeqMap.get(key2);
    if(value1.getValue() > value2.getValue()) {
    return 1;
    } else if(value1.getValue() == value2.getValue()) {
    return 0;
    } else {
    return -1;
    In the above code I tried to perform sorting of DisplaySequence values using comparator, then tried to rearrange
    nodes or rows based on sort resurts. But rsi.insertRowAtRangeIndex(rowIndex, currentRow) give
    DeadViewException...unable to find view reference. While setting current row also does not work.
    Approach 3.
    DCIteratorBinding iter1 =
    bindings.findIteratorBinding("childIterator");
    iter1.executeQuery();
    SortCriteria sc = new SortCriteriaImpl("DisplaySequence",false);
    SortCriteria [] scArray = new SortCriteria[1];
    scArray[0] = sc;
    iter1.applySortCriteria(scArray);
    Any help in Sorting Child nodes ADF treeTable is appreciated. Thanks in Advance.
    Abhishek

    Hi Frank,
    Thanks for your reply. I have tried similar approach for sorting tree table child rows based on user specified number and it works. But there is a limitation for this. This sorting works only for read only/transient view object. For updatable view object after sorting, data cannot be saved or updated, as it cannot find the rowid. Here is what I tried
    In the ParentViewImpl class,
    1. overrode the method createViewLinkAccessorRS, so that this method is forcefully executed.
    @Override
    protected ViewRowSetImpl createViewLinkAccessorRS(AssociationDefImpl associationDefImpl,
    oracle.jbo.server.ViewObjectImpl viewObjectImpl,
    Row row,
    Object[] object) {
    ViewRowSetImpl viewRowSetImpl = super.createViewLinkAccessorRS(associationDefImpl, viewObjectImpl, row, object);
    return viewRowSetImpl;
    2. Added the following method, which will be invoked on valueChange of DisplaySequence in child row. Expose this method through client interface. This method accept a parameter i.e. parent row key of the child row.
    public void sortChildRecords(Key parentKey) {
    ViewObject viewObject = null;
    String type = null;
    if(parentKey==null) {
    Row [] row = this.findByKey(parentKey, 1);
    RowSet rowSet = (RowSet)row[0].getAttribute("ChildVO");
    viewObject = rowSet.getViewObject();
    viewObject.setSortBy("DisplaySequence asc");
    }else {
    Row row = getCurrentRow();
    RowSet rowSet = (RowSet)row.getAttribute("ChildVO");
    viewObject = rowSet.getViewObject();
    viewObject.setSortBy("DisplaySequence asc");
    this.setQueryMode(ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES |
    ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS);
    this.executeQuery();
    For custom sort, lets say all the numbers should be display first in ascending order, and null or empty values to be display at the end need to override the getRowComparator method in the ChildViewImpl class,
    Here is the code for the same
    @Override
    public Comparator getRowComparator() {
    SortCriteria sortCriteria = new SortCriteriaImpl("DisplaySequence",false);
    SortCriteria [] sortCriterias = new SortCriteria[1];
    sortCriterias[0] = sortCriteria;
    return new DisplaySequenceComparator(sortCriterias);
    private class DisplaySequenceComparator extends RowComparator {
    public DisplaySequenceComparator(SortCriteria [] sortCriterias) {
    super(sortCriterias);
    public int compareRows(Row row1, Row row2) {
    Object dispSeqObj1;
    Object dispSeqObj2;
    Number dispSeq1 = null;
    Number dispSeq2 = null;
    boolean compareRow1 = true;
    boolean compareRow2 = true;
    if(row1!=null) {
    dispSeqObj1 = row1.getAttribute("DisplaySequence");
    if(dispSeqObj1!=null && dispSeqObj1 instanceof Number) {
    dispSeq1 = (Number)dispSeqObj1;
    }else {
    compareRow1 = false;
    if(row2!=null) {
    dispSeqObj2 = row2.getAttribute("DisplaySequence");
    if(dispSeqObj2!=null && dispSeqObj2 instanceof Number) {
    dispSeq2 = (Number)dispSeqObj2;
    }else {
    compareRow2 = false;
    if(compareRow1 && compareRow2) {
    if(dispSeq1.getValue() > dispSeq2.getValue()) {
    return 1;
    } else if(dispSeq1.getValue() == dispSeq2.getValue()) {
    return 0;
    } else {
    return -1;
    if(!compareRow1 && compareRow2)
    return 1;
    if(compareRow1 && !compareRow2)
    return -1;
    return 0;
    The above solution works properly, and sorts the child tree rows. But while saving the changes, update fails. I also came to know that in-memory sorting is applicable to read-only/transient view objects from some blogs and also mentiond in this link http://docs.oracle.com/cd/E24382_01/web.1112/e16182/bcadvvo.htm
    Is there any way that updatable view objects can be sorted and saved as well?
    Thanks,
    Abhishek
    Edited by: 930857 on May 2, 2012 7:12 AM

  • Row selection messed up after sorting

    JDev version: 11.1.1.4 (but also reproducable in 11.1.2.1)
    See http://kpdwiki.be/Bart_L/tableIteratorSortSync.zip (open BO726.jws and run runThis.jspx)
    Situation:
    - iterator 'EmployeesIterator' which points to a view with Employees -> ChangeEventPolicy='none'
    - Bindings which all point to this iterator:
    - Tree binding 'Employees' used for an af:table with employees (firstname, lastname)
    - Attribute bindings 'FirstName' and 'LastName' which is used in a formLayout to show the currently selected employee
    - Operation Bindings to iterate through the employees (First, Previous, Next, Last)
    - runThis.jspx
    - formlayout with FirstName and LastName
    -> partialtriggers: Next-button and table (for the rest, no partialtriggers)
    - Next-button
    - table with employees
    Problem:
    1) if you select one of the employees in the table, and sort one of the columns, the first row will be selected. This is normal behaviour
    2)
    a) select the first row
    b) press the 'Next' button a few times. Now the selected employee in the iterator is 'X'
    c) in the table, select employee 'X' by clicking on its row
    d) sort one of the columns.
    Result: In the iterator, the first row of the table is selected, while the table selection shows something different!
    --> this is different behavior than the situation described in 1)
    --> after doing something with the table (sorting, filtering, selecting rows, ...), I would expect that the selected row in the table is always the same as the selected row in the iterator.
    Questions:
    1) Is this a bug?
    2) If yes, is this a known bug?
    3) If no: am I doing something which is not allowed? Or should I do something different here?

    I can reproduce the problem in 11.1.1.4.
    First employee is Steven King, which is selected. I then press next a few times till the output text reads Bruce Ernst (the table selection is still on Steven King, while the iterator points to Bruce Ernst). I then click on Bruce Ernst in the table, so it is selected (iterator stays on the same record). If I then sort the table, the table selection stays on Bruce Ernst, while the output text shows the first record in the table after the sort.
    We have the same issue using a non-modal popup to edit table rows (non-isolated task flow, sharing data controls & transaction). Our edit popup has navigation controls. When we scroll through records in the popup, the table selection doesnt refresh (changeEventPolicy = none). If we then select the record in the table that we scrolled to in the popup , without closing the popup, and then sort the table (with the popup still open), the selection stays on the previously selected record, whille the popup shows the first record in the table after the sort.

  • How to exclude one or more rows of SQL report from sorting?

    In my SQL report I want to exclude one row from sorting. This row must be permanently at the bottom of the report.
    How to achieve this?
    Regards,
    Al

    Hi Al,
    Check out this thread: Sort within Break? I was looking to preserve a basic sort for break purposes, but the same solution should work for keeping one row at the bottom.
    Let me know if you'd like more details.
    --Jennifer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How do I sort my whole spreadsheet based on one row?

    I'm using Numbers on my iPad to inventory a school's computer systems.  I'm kind of doing it slowly as I get time, so I'm not inventorying in any particular order.  I just go in a room when I get a chance and then inventory everything in it. 
    I have different columns for room, asset #, make, model, serial, inventory date
    Just a few minutes ago, I was trying to sort my sheet by the asset # so I could see what gaps I have in the asset numbers.  I selected the top bar and it highlights the whole column.  Then I select sort and it only sorts the one column, which then totally screws up my sheet because my asset numbers are next to different random PCs that I just happened to inventory first.  So, of course, I undo it.  But I would like to be able to sort by asset # and have it sort all the cells based on the asset #, or sort by make or model and then I could see all the computers with a certain make or model and where they're at.  There has to be a way to do this.

    I probably said it backwards.  I've been calling them columns...  I think I mean rows.  The rows have data up and down.  I want to sort it so the lowest values at the top and highest values at the bottom.  But I want all the other cells to stay sorted.  Right now if I just select sort for the row, it sorts the one row and not the rest of them so it totally messes up my sheet.
    It's just an inventory that I have a field that says make, model, asset #, serial, room #, etc.
    I'd like to sort by asset # to see all the PCs and if I have a gap.  Then I'd like to sort it by room number so when I walk in a room, I can tell if I missed a PC in the room and verify what I have.  Then I might want to sort by the year row when we decide to upgrade so I can put all the oldest PCs first.  But if it just sorts the row and not all the other columns in the row, it totally messes up my sheet.  It just puts my years of pc from oldest to newest but didn't sort the rest of the fields.  In Excel, if I do that, it sorts all the fields based on the one row.
    I'm not sure how to give you a screenshot off my ipad.

Maybe you are looking for