Multiple Criteria LOV with programatic criteria

Hi,
I am stuck up with a requirement. I have an LOV which is based on a lov vo having two columns, equipment and plant.
I type an equipment name and pass an additional criteria of plant which is based on a poplist.
So basically the query in the backend would get the where clause like this :
plant = :1 and equipment_name like :2 ...
My requirement here is to have the plant search to have something like .. plant in(:1,-99999) or plant=:1 or plant =-99999 instead of just one value (:1) where -99999 is a default which would always be there.
I tried to create another lov and map it to the another plant item in the lov but that didn;t help.
After reading few posts on the programmatic criteria, i set the programmatic query = true for the plant and then in the CO i placed this code :
processFormRequest -:
if ("EquipmentLOV".equals(lovInputSourceId)) {
super.processRequest(pageContext, webBean);
OAApplicationModule lov_am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
Dictionary lov_dict = pageContext.getLovCriteriaItems();
String lov_criteria = (String)lov_dict.get("PlantId");
Serializable lov_params[] = { lov_criteria };
lov_am.invokeMethod("initlovvo", lov_params);
in the AM i placed this code:
public void initlovvo(String plant) {
Integer planti = Integer.parseInt(plant);
MTHEquipmentsLOVVVOImpl vo = getMTHEquipmentsLOVVVO();
// vo.setWhereClause(null);
//vo.setWhereClauseParams(null);
if (planti != null) {
vo.setWhereClause("PLANT_ID IN (:1,-99999)");
vo.setWhereClauseParam(0, planti);
vo.executeQuery();
I have commented the setWhereClause(null); thinking that it might clear the equipment part of the where clause or the pre-set where clause in the VO.
However, i am still not able to get the desired results.
Any inputs as to how i can get this working.
Thanks,
Ankit

Shiv,
I am able to get the required functionality and the query is getting generated properly. The trigger is getting fired both when i tab out and click on the torch light unlike my previous observation.
However, if i am getting a null pointer exception when i click on the value in the lov. The name of the equipment is 'Unassigned'. If i type U and tab out then the lov field is populated automatically. However, if i give criteria as % and click on torchlight , and then select the unassigned equipment or any other value , then i get this null pointer exception.
Please advice.
Exception Details.
oracle.apps.fnd.framework.OAException: java.lang.NullPointerException at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:896) at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1169) at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1435) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2844) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595) ## Detail 0 ## java.lang.NullPointerException at oracle.apps.mth.device.tagsetup.webui.MTHGlobalReqionCO.processFormRequest(MTHGlobalReqionCO.java:194) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:813) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1178) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2840) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595) java.lang.NullPointerException at oracle.apps.mth.device.tagsetup.webui.MTHGlobalReqionCO.processFormRequest(MTHGlobalReqionCO.java:194) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:813) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1178) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2840) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)

Similar Messages

  • Problem using multiple choice LOV with custom attribute in IAS 10.1.2.0.2

    Hi
    When aplying a multiple choice and selecting multiple selection and saving in the content area , everything looks fine .
    However when looking at the page the selection is only the first one selected and not the miltiple choices I made
    can someone tell me what is going on , does the miltiple selection with custom attribute
    works ??
    thanks in advance
    Igal

    Hi there,
    I don't really understand what you're doing but I used lot of LOV in custom attributes on my custom items and everything works fine.
    Can you explain more your problem ?

  • Problem using multiple choice LOV with custom attribute

    v 9.0.2
    I cannot find how to use a LOV as a check box or a multiple select for a custom attribute. It shows up as a combo box whatever setting I choose for the default format field in the LOV wizard.
    I need to give the opportunity to choose more than one option from the LOV for the attribute when adding the custom item associated with the attribute. How do I do this?

    Oops wrong forum - have reentered this in content mgmt forum. Disregard this entry.

  • Cascade LOV with multiselect in View Criteria

    Hi All,
    Is there any way to create a cascade LOV with multiselect in View Criteria.
    Ex. If a select multiple Countries from the parent LOV, the child LOV would display the list of States for the selected Countries in a view Criteria.
    Regards,
    Koushik

    Hi Jabr,
    I feel clumsy, now I have this problem.
    When I set in the format mask yyyy-MM-dd G 'at' hh:mm:ss I can use only am hours. I tried to cancel 'at' and I wrote at runtime 2011-03-23 15:30:00 but when I run it I got an error about the time format. I can use the time from 00:00:00 to 11:59:59 am.
    Thanks

  • Counting rows with multiple criteria

    I know this is a silly beginner question, but is there an easy way to count the number of rows in a table which match criteria based on different columns (sort of a countif with multiple criteria). For example, if Column A in a table has "All, Some, None" responses and Column B has "Main, Off" responses, is there an easy way to count the number of rows in which Column A has All and Column B has Off?

    Neondiet wrote:
    From an intellectual and philosophical view I agree with you. But from a practical view what I really want to do is just use one application for my spreadsheet tasks, not jump back and forth because one sheet I share with MS Windows users, and another with Numbers users, and another with OS X users who don't have Numbers or Excel but do have NeoOffice. Maybe I have to settle for that though.
    Yeah... this kind of situation stinks. Its like needing to writing software that will run on both Macs and PCs.
    Anyway, I've followed the advise in this forum and resorted to using a hidden column with concatenated values to solve my own problem, though it does seem like a bit of a hack compared to managing a single formula in a single cell. Horses for courses I suppose.
    jaxjason has posted a very elegant pivot table like solution that utilizes this technique. See http://www.numberstemplates.com/forums/showthread.php?t=36
    Btw, from what I've read on the net to date, SUM (in Excel) with an array formula answers the original authors problem of counting occurrences of values, not SUMPRODUCT; which I believe sums up the contents of cells in a range, if cells in other ranges match specific criteria.
    Yes, if you use the '*' (as indicated above) then SUM() is sufficient though SUMPRODUCT() will work as it degenerates to SUM when there is only one argument. If you use two arrays as arguments (like: = SUMPRODUCT((A1:A4="All"), (B1:B4="Off")), then SUMPRODUCT() is necessary. Here's my understanding of how it works (I hope your able to follow my abuse of algebraic techniques):
    =SUM((A1:A4="All") * (B1:B4="Off"))
    expanding the array expressions...
    =SUM((A1="All", A2="All", A3="All", A4="All") * (B1="Off", B2="Off", B3="Off", B4="Off"))
    at this point Excel computes the equality expressions, for example...
    =SUM((TRUE, FALSE, TRUE, FALSE) * (TRUE, TRUE, FALSE, FALSE))
    expanding the array multiplication...
    =SUM((TRUE * TRUE, FALSE * TRUE, TRUE * FALSE, FALSE * FALSE))
    Excel, apparently, then, when forced to multiply Boolean values, maps TRUE -> 1 and FALSE -> 0...
    =SUM((1 * 1, 0 * 1, 1 * 0, 0 * 0))
    performing the multiplications...
    =SUM((1, 0, 0, 0))
    summing...
    =1 + 0 + 0 + 0
    resulting...
    =1
    I'm afraid, now, if I continue any further, Yvan will chastise me.

  • Multiple criteria search with 4 dropdown lists

    I want to perform a multiple criteria search on a MySQL
    database. Users should be able to use from 4 dropdown lists in a
    form only one criterium, all 4 of them or 2 or 3.
    Each used dropdown list gives a numeric variable: Fvar1 ...
    Fvar4. The variables from the dropdown lists used should be matched
    with numeric fields in the database: DBvar1...DBvar4
    The numeric variables from the dropdown lists that are not
    used, should be ignored.
    Example: a user selects a value in dropdown list 2 and 3 and
    does not use dropdown lists 1 and 4. Fvar1 and Fvar 4 should then
    be ignored for the search, that has to be performed with Fvar2 and
    Fvar3, who have to be matched with DBvar2 and DBvar3.
    Anyone who can help me out with the WHERE statement in my SQL
    query?
    Your help will be greatly appreciated.
    Erik

    Erik61 wrote:
    > I want to perform a multiple criteria search on a MySQL
    database. Users should
    > be able to use from 4 dropdown lists in a form only one
    criterium, all 4 of
    > them or 2 or 3.
    Start by using the Advanced Recordset dialog box to create a
    query that
    looks for all four variables. Then switch to Code view and
    start carving
    up the code created by Dreamweaver.
    The query will look something like this:
    $query_getProducts = sprintf("SELECT product_name, price
    FROM products
    WHERE prod_type = %s AND colour = %s AND size = %s AND range
    = %s
    ORDER BY price ASC",
    GetSQLValueString($var1_getProducts, "text"),
    GetSQLValueString($var2_getProducts, "text"),
    GetSQLValueString($var3_getProducts, "text"),
    GetSQLValueString($var4_getProducts, "text"));
    Change it like this:
    $query_getProducts = "SELECT product_name, price
    FROM products
    WHERE ";
    $where = false;
    if (!empty($_GET['prod_type')) {
    $query_getProducts .= sprintf("prod_type = %s ",
    GetSQLValueString($var1_getProducts, "text"));
    $where = true;
    if (!empty($_GET['colour'])) {
    if ($where) {
    $query_getProducts .= 'AND ';
    $query_getProducts .= sprintf('colour = %s ',
    GetSQLValueString($var2_getProducts, "text"));
    $where = true;
    if (!empty($_GET['size'])) {
    if ($where) {
    $query_getProducts .= 'AND ';
    $query_getProducts .= sprintf('size = %s ',
    GetSQLValueString($var3_getProducts, "text"));
    $where = true;
    if (!empty($_GET['range'])) {
    if ($where) {
    $query_getProducts .= 'AND ';
    $query_getProducts .= sprintf('range = %s',
    GetSQLValueString($var4_getProducts, "text"));
    That builds the query in stages using $where to decide
    whether to add
    "AND" in front of the second, third, and fourth variables.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Search with multiple criteria

    I have searched high and low on the internet o find a way to
    do a search through multple fields but the more I lookthe more i
    get confused. here is the problem. i want to do a search where the
    user can input a data element and select the matching type and
    display he results.below is the code that i have for my search
    page, but I am confused about the more important parts of the fom -
    the actual search variables.
    If you look t the code below you see that I have a test field
    named "recordID" and a drop down list named "select".
    I want to dispay the results in which 'recordID' looks in
    table thatis equal to 'select'.
    an example of what I want is at the following link.
    http://www.phpscriptsearch.com/

    DizzDizzy wrote:
    > I went to
    http://www.webassist.com/professional/products/productdetails=
    =2Easp?PID=3D117&CouponID=3Dss2008&RID=3D590&WAAID=3D92
    > but i could not find the solution there
    Hi Dizz:
    Under the banner you'll find links for Overview, Features,
    System=20
    Requirements, Support. When you click on the Features link,
    the MooFX=20
    Accordian javascript class runs to update the content on the
    page. The=20
    bullet points are clickable to similarly update the content
    on the page. =
    Click on the bullet point "Pro search and sort enhancements"
    and read=20
    the paragraph at the bottom under the screen shots:
    Sophisticated search capabilities
    DataAssist integrates the advanced search functionality
    previously=20
    available in Database Search. Now you can combine advanced
    Google-style=20
    keyword searches (across multiple database columns) with
    price, date or=20
    number ranges =96 all without coding.
    Please take a look at the feature tour:
    http://www.webassist.com/professional/products/featuretour/media_117.asp
    As for the Prof's requirements, the form submits two values,
    a recordID=20
    and a selection to either search by company or by store
    number.
    If Prof has a table named company and another named store
    number, the=20
    way you'd search these tables would be to have another table
    that=20
    contains the selectcategories with a column containing the
    values=20
    "company" and "storeNumber" along with ID columns that relate
    to a=20
    categoryID column in the companies table and the storeNumber
    column in=20
    the Stores table. Using this relationship Prof can create a
    reccordset=20
    on his results page that returns the values using an INNER
    JOIN to=20
    combine the tables in the recordset. Similarly by
    constructing the=20
    relationships properly as to his records (let's say he's
    searching 45RPM =
    singles - anybody remember those thingies?) His company table
    can have=20
    an ID column that references his product table where a
    companyID is=20
    stored. Again, a JOIN statement is used to include the
    product=20
    information, including the ProductID in the Recordset.
    Similarly for the =
    Stores table, again, the Products table has a column that
    identifies the =
    store that carries that productID. If more than one store
    carries the=20
    product, the column should be a storesID column that
    references a=20
    ProductStores table which references the stores that carry
    the product=20
    by a common ID. Again, using the JOIN (this recordset query
    would get=20
    complex) the necessary data can be returned.
    The DataAssist Search Server Behavior applies a sophisticated
    WHERE=20
    clause to the recordset. so that the requested records can be
    returned=20
    to the page. Prof is not needing a tool to build database
    management, so =
    I can see his point... but if this is something you do
    regularly,=20
    DataAssist will pay for itself over and over in time saved.
    And WebAssist is conducting a 50% off sale through next
    Friday, so it's=20
    a good time to get on board. Here's a link to the discount
    page for all=20
    the products:
    http://www.webassist.com/professional/products/productresults.asp?CouponI=
    D=3Dss2008&RID=3D590&WAAID=3D92=20
    enthusiastically,
    mark haynes.

  • Can't 'find' using multiple criteria anymore

    Did something change in Finder such that we can't set multiple criteria for searches any more? Or is my Finder corrupt in some way?
    In a finder "Find" window, I have the search bar showing "This Mac" the current folder and the options "Contents" and "File Name" -- then there's "Save" and the little '+' icon. It used to be I could add additional search criteria by clicking the '+' (such as file visibility, extension, etc.) -- but now, clicking the '+' just opens an empty space below the existing search bar.
    Is there a 'Simple Finder' setting somewhere that got switched without my knowledge causing this? Or is my Finder borked?
    Thanks,
    Scott

    Well, I'd try moving the finder prefs file, but last night when I went to restart my MBP to deal with something else, on restart all video was gone. I even tried booting into the Apple Hardware Test on the Leopard install DVD, and while it seemed to boot up okay, there was nothing on the screen at all.
    Took it into an Apple Store this morning, and they ran a test, and found the graphics card/chip not even registering - so it looks like I'm into a new logic board. Thanks goodness I got AppleCare this time!!
    So, when I get my baby back, I'll see if the Finder issue is still there, and if so, then I'll try moving the finder prefs file out.
    Thanks,
    Scott

  • Multiple criteria for Smart Playlists

    When I want to make a Smart Playlist with multiple criteria, such as a SP for my Classical and Jazz songs only, I select genre, then type in Classical, following that I click the "+" button next to that and put Jazz as my Genre. I click save, then I get a dialogue box that tells me about non-matching items. Is a multi criteria SP even possible or am I just not doing it right?

    Logically, that makes sense, of course (it's not your "entire" lib, it's just everything except Harry)
    There might be another way, but here's how I would do what you want:
    I'd create a new folder and place two SPs in it, one for classical and one for Jazz. Then I'd create a third one that consists of "Playlist Classical" and "Playlist Jazz".
    It sounds sloppy, but you could use that single folder for any playlist you wanted to use in this way, keeping the combination SPs out in the straight listing.
    Hope that helps
    <hr width="250" align="left">
    HangTime [Will Compute for Food] B-)>
    ♪♫ The Bullets and Bones Band ♫♪
    Disclaimer<hr width="250" align="left">

  • Sorting a Vector by multiple criteria

    Hi,
    I am trying to sort a Vector by multiple criteria. For example, the Vector must first be sorted by category 1, then category 2, etc.
    This is my code so far:
    Vector<Item> temp = new Vector<Item>(items.size());
    Collections.sort(temp, new ByFilename());
    Collections.sort(temp, new BySong());
    Collections.sort(temp, new ByArtist());
         private static class Item
              String CD, track, song, artist, details, filename;
              int row;
              Item(String c, String t, String s, String a, String d, String f, int r)
                   CD = c;
                   track = t;
                   song = s;
                   artist = a;
                   details = d;
                   filename = f;
                   row = r;
         private static class ByFilename implements Comparator<Item>
              public int compare (Item one, Item two)
                   return  one.filename.compareTo(two.filename);
         private static class BySong implements Comparator<Item>
              public int compare (Item one, Item two)
                   return  one.song.compareTo(two.song);
         private static class ByArtist implements Comparator<Item>
              public int compare (Item one, Item two)
                   return  one.artist.compareTo(two.artist);
         }Except this sorts the Vector by Filename, then sorts again from scratch by song, then again from scratch by artist. However, I want it sorted by Filename, with the duplicate Filenames sorted by song, and entries with the same Filename and songs, sorted by artist. I hope this makes sense!!
    Does anyone have any ideas? I tried sorting by filename, finding the duplicates, sorting these in a separate vector and then adding back in, but it didn't work and was too messy. There has to be an easier way... that is much less fiddly.
    Thanks in advance for any help :)

    Here's a demo of using chained comparators.
    import java.util.*;
    public class Item {
        String a, b, c;
        public Item(String a, String b, String c) {
            this.a = a;
            this.b = b;
            this.c = c;
        public String toString() {
            return  a +  b + c;
        public static void main(String[] args) {
            Item[] items = {
                new Item("0","1","1"),
                new Item("1","1","1"),
                new Item("0","1","0"),
                new Item("1","1","0"),
                new Item("0","0","1"),
                new Item("1","0","1"),
                new Item("0","0","0"),
                new Item("1","0","0"),
            Arrays.sort(items, new ByA(new ByB(new ByC(null))));
            System.out.println(Arrays.toString(items));
    class ByA implements Comparator<Item> {
        Comparator<Item> tieBreaker;
        ByA(Comparator<Item> tieBreaker) {
            this.tieBreaker = tieBreaker;
        public int compare (Item one, Item two){
            int result = one.a.compareTo(two.a);
            if (result == 0 && tieBreaker != null) {
                result = tieBreaker.compare(one, two);
            return result;
    class ByB implements Comparator<Item> {
        Comparator<Item> tieBreaker;
        ByB(Comparator<Item> tieBreaker) {
            this.tieBreaker = tieBreaker;
        public int compare (Item one, Item two){
            int result = one.b.compareTo(two.b);
            if (result == 0 && tieBreaker != null) {
                result = tieBreaker.compare(one, two);
            return result;
    class ByC implements Comparator<Item> {
        Comparator<Item> tieBreaker;
        ByC(Comparator<Item> tieBreaker) {
            this.tieBreaker = tieBreaker;
        public int compare (Item one, Item two){
            int result = one.c.compareTo(two.c);
            if (result == 0 && tieBreaker != null) {
                result = tieBreaker.compare(one, two);
            return result;
    }

  • Help me write command in vba(excel) to search and find special cells based on multiple criteria

    Hi 
    My name is Majid Javnmard , I am using Microsoft Office Excel 2010 and I encountered a problem. I sent you a simple example of my excel file that i want to write a command in vba to search and find special cell and copy the row which special cell is in there
    somewhere , but the problem is how can i find my special cell with multiple criteria or how can i find my all special cells and copy them somewhere !!? 
    Let me explain on file that i sent :
    This file has 4 headers (X,Y,PerturbNumber,Value), the problem is for example : I want write commnd in vba to copy all rows that each of them has (X=12 and Y=13). how can i ? can you help me ?
    My
    file : http://s000.tinyupload.com/index.php?file_id=69742844961096241754
    Many Thanks
    Majid 

    This worked for me, based on your example:
    Sub pMain()
    Dim wsSource As Excel.Worksheet
    Dim wsDest As Excel.Worksheet
    Dim lSource As Long
    Dim lDest As Long
    Dim lLast As Long
    With ThisWorkbook
    'Change to suit
    Set wsSource = .Worksheets("Sheet1")
    Set wsDest = .Worksheets.Add
    End With
    wsSource.Rows(1).Copy
    wsDest.Range("A1").PasteSpecial xlPasteValues
    lDest = 2
    lLast = wsSource.Cells(wsSource.Rows.Count, "A").End(xlUp).Row
    For lSource = 1 To lLast
    'Put the conditions below:
    If wsSource.Cells(lSource, "A") <> 12 Then GoTo linNext
    If wsSource.Cells(lSource, "B") <> 30 Then GoTo linNext
    'If wsSource.Cells(lSource, "C") <> "value" Then GoTo linNext
    'If wsSource.Cells(lSource, "D") <> "value" Then GoTo linNext
    'Conditions were met:
    wsSource.Rows(lSource).Copy
    wsDest.Rows(lDest).PasteSpecial xlPasteValues
    lDest = lDest + 1
    linNext:
    Next lSource
    End Sub
    Felipe Costa Gualberto - http://www.ambienteoffice.com.br

  • Metadata searching - multiple criteria?

    Just wondering if it's possible to set multiple criteria in a metadata search? For example, imagine I have some photos where the captions include the words "Bob Jones" and some where they contain "Bob Davies". Is there any way to search for 'caption includes BOB' AND 'caption does not include JONES'.
    I appreciate that in the example above I could just search for 'Bob Davies' but this is a simplified example!

    Well the only other ones mentioned in the help are "+" at the start of a word for "starts with" and "+" at the end of a word for "ends with". There are other things I'd like to do; for example, I have photos with the following metadata in the title field:
    Photo 1: Bob Jones
    Photo 2: Bob Davies
    Photo 3: Bob Jenkins
    Photo 4: Bob Williams
    Photo 5: Bob Smith
    How can I search for Bob AND (Jones OR Davies)? Is that even possible? I know I could do it with a Smart Collection, but I find it much easier to do stuff like that with a quick text search. I often also don't need to save the results, just to see what pops up - creating a Smart Collection seems like overkill.

  • Grouping of multiple criterias as expression

    Dear all
    I want to do a grouping of multiple criterias as expression .
    Single grouping is possible , but when group within a group comes things doesnt work for me.
    User would define the comibination
    For example i have 4 criterias
    C1
    C2
    C3
    C4
    Basic grouping works for example :
    (C1&C2) | (C3&C4)
    Complicated grouping i have no idea how to implement it.
    (((C1&C2) | (C3&C4))&(C1&C2) )
    I need validate if the expression is correct and need to pick up all the groups and do the AND or OR.
    Any help woul dbe appriciated
    Regards
    pacs

    fiveohg wrote:
    Complicated grouping i have no idea how to implement it.
    (((C1&C2) | (C3&C4))&(C1&C2) )
    I need validate if the expression is correct and need to pick up all the groups and do the AND or OR.As already suggested: you could write your own grammar and let a parser-generator create a lexer/parser for you.
    Another option is to use some scripting engine and bind your C-variables before evaluating your expression:
    import javax.script.*;
    public class Foo {
      public static void main(String[] args) throws Exception {
          String expression = "(((C1 && C2) || (C3 && C4)) && (C1 && C2))";
          ScriptEngineManager manager = new ScriptEngineManager();
          ScriptEngine engine = manager.getEngineByName("js");
          engine.put("C1", true);
          engine.put("C2", true);
          engine.put("C3", false);
          engine.put("C4", true);
          System.out.println(engine.eval(expression));
    }Note that you cannot user '|' and '&', in that case.
    The JavaScript (Rhino) engine is built-in in Java 6, but there are more that can be imported: [https://scripting.dev.java.net/]

  • Totals Based on Multiple Criteria in Repeating Rows

    Hi All,
    I have 3 dropdowns (DD1, DD2, DD3) and one textfield (TF1) in repeating rows (not in a table).  Each dropdown has two choices and the textfield is free-form. Outside of the rows (in a different subform) I want totals based on multiple criteria from the dropdowns and textfields.
    The following script works great to get a total number of one choice from one dropdown.
    this.rawValue = xfa.resolveNodes('form1.Form.row[*].DD1.[$.rawValue == "2"]').length;
    Problem is how do I calculate the totals for the following based on the criteria listed in each row.
    Find the totals for ML
    Number of New Forms 1-2 Pages: (result should be 2)
    Number of New Forms 3+ Pages: (result should be 1)
    Number of Revised Form: (result should be 0)
    In row #1:  select “New” as a choice from DD1, “Form” as choice from DD2, “ML” as a choice from DD3 and enter “5” in TF1.
    In row #2:  select “New” as a choice from DD1, “Form” as choice from DD2 , “ML” as a choice from DD3 and enter “1” in TF1.
    In row #3:  select “New” as a choice from DD1, “Form” as choice from DD2, “ML” as a choice from DD3 and enter “2” in TF1.
    In row #4:  select “Revised” as a choice from DD1, “Series” as choice from DD2, “ML” as a choice from DD3 and enter “1” in TF1.
    In row #5:  select “New” as a choice from DD1, “Form” as choice from DD2, “PM” as a choice from DD3 and enter “1” in TF1.

    Try something like;
    var mlNewForms1or2Pages = 0;
    var mlNewFormsOver3Pages = 0;
    var mlRevisedForms = 0;
    var rows = xfa.resolveNodes('form1.Form.row[*]');
    for (var i = 0, limit = rows.length; i < limit; i++)
    var currentRow = rows.item(i);
    if (currentRow.DD1.rawValue == "1") // new
      if (currentRow.DD2.rawValue == "1") // form
       if (currentRow.DD3.rawValue == "1") // ML
        if (parseInt(currentRow.TF1.rawValue, 10) > 2)
         mlNewFormsOver3Pages++;
        else
         mlNewForms1or2Pages++;
    else // revised
      if (currentRow.DD2.rawValue == "1") // form
       if (currentRow.DD3.rawValue == "1") // ML
        mlRevisedForms++
    console.println(mlNewForms1or2Pages);
    console.println(mlNewFormsOver3Pages);
    console.println(mlRevisedForms);
    To do the same using predicates you could do;
    var mlNewForms1or2Pages = 0;
    var mlNewFormsOver3Pages = 0;
    var mlRevisedForms = 0;
    mlNewForms1or2Pages = xfa.resolveNodes('form1.Form.row.[DD1 == 1 and DD2 == 1 and DD3 == 1 and TF1 <= 2]').length;
    mlNewFormsOver3Pages = xfa.resolveNodes('form1.Form.row.[DD1 == 1 and DD2 == 1 and DD3 == 1 and TF1 > 2]').length;
    mlRevisedForms = xfa.resolveNodes('form1.Form.row.[DD1 == 2 and DD2 == 1 and DD3 == 1]').length;
    But if you wanted totals for all the permutations then this could become slow.
    Regards
    Bruce

  • LOV with auto suggest and multiple check boxes

    Is it possible to implement LOV with auto suggest and multiple check boxes using ADF faces components?. Any alternative implementation/pointers are appreciated.
    Regards,
    Surya

    Hi,
    build it yourself as a task flow opened in a popup. see: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/69-custom-lov-with-btf-276178.pdf
    Frank

Maybe you are looking for