Generating dynamic search query for search formular

Hallo guys,
a theoretical question I have there for you.
I have a search form in HTML with several input fields, so the user can search for particular features in a db.
My queiston: How can I generate a dynamic query, depending on which fields the user had filled in?
It should look like this:
> look at the input fields:
> if request.getParameter("art) !=null : Query "+" age
> if request.getParameter("experience") !=0 : Query "+" experience
> if request.getParameter("instrument") != null : Query "+" instrument
> .... and so on
final query = SELECT art, experience,instrument FROM x, y, z WHERE x.art = art AND y.experience > experience AND z.instrument LIKE '%instrumen%' ;I hope I have explained it somehow understandable.
Any help is deeply appreciated! Thank you in advance...
fankoff
Edited by: fankoff on Jun 21, 2010 9:55 AM

for every ? in your preparedQuery, you need a preparedQuery.set...
why do you use reflection to get the length of an array? why not use:
int[] ar = {1,2,3,4};
System.out.println(ar.length);you might want to consider using "... WHERE title IN (title1, title2, ..) OR content IN (content1, content2,...)"
now unfortunatly jdbc seems to be not properly specified with the #setArray, oracle uses it in above mentioned context(e.g. "... WHERE title IN ?" and you set a string-array) mysql doesn't.(you would need something like "...WHERE title IN (?,?,?,?,?)"
but in either of this case, or yours, its usually better to create a prepared query once, and than just insert the values with each fetch. just use enough ?'s and set the not-needed ones to NULL. it will still be more efficient than creating a query everytime.

Similar Messages

  • How to run a search query for a particular folder in KM related to portal

    Hi,
    Can any one tell me the steps for : how to run a search query for a particular folder in knowledge management related to portal.
    Answers will be rewarded.
    Thanks in advance.
    KN
    Edited by: KN on Mar 18, 2008 6:33 AM

    Ok u may not require a coding
    But u req configuration
    U should first make a search option set
    Link: [Search Option set|http://help.sap.com/saphelp_nw04/helpdata/en/cc/f4e77ddef1244380b06fee5f8b892a/frameset.htm]
    Then u need 2 duplicate a KM Command by the name Search From here
    and customize it to include the Search Option that u have created
    Link: [Search from here|http://help.sap.com/saphelp_nw04/helpdata/en/2a/4ff640365d8566e10000000a1550b0/frameset.htm]
    Then in the layout add this command.
    Regards
    BP

  • How do I use "Search Query" for nontrivial searches?

    After a few years in the community, this is my _first_ question to the boards ;-)
    In speaking with a colleague today, I learned about an NI forum feature that would be useful for me. When I tried to configure it, I then learned that I didn't know how to use it. When I tried to learn how to use it, I further learned that it wasn't fully documented. So, I'd like some clarification :-)
    The feature in question is "Search Query" which will send you an email when a forum search matches your query. What I don't know is:
    What are the rules (syntax) for search queries? For example, I would like to search for single words, all the words that I specify, as well as exact phrases. How do I differentiate between multiword queries and exact phrase queries?
    Is it possible to have more than one Search Query?
    If so, how do you delineate them? Would I use commas, a new line, something else?
    I'm asking because the available (and discoverable) documentation doesn't mention what to do when you want more than one Search Query. The help text on the subscription page [1] makes me think that only one query is possible, and says a Search Query:
    Sends you mail every time a message matching your query is submitted. Search queries take up to 15 minutes to take effect. Saving a blank query will disable this feature and will stop any mail from being sent.
    The other place I tried was the NI Forum FAQ [2], which makes me think that more than one query is possible:
    If you add a board, thread, message, or search term to your subscriptions, the system will send you an e-mail every time someone posts to the board, or replies to the message or thread. If you prefer not to receive an e-mail for your subscriptions, you can subscribe to the RSS feed of a board, thread, user, or search term.
    The FAQ goes on about what to do with board, thread, and message subscriptions, but doesn't say anything more about search subscriptions.
    The last place I looked was on the search results page itself. In the blue header that precedes the results, there's a link on the far left that says "Search Options" with a single option that says "Subscribe to this search's RSS Feed". While I could subscribe and use an RSS reader, I really would prefer email. I suppose if only one Search Query is possible, then this will be my workaround.
    As a comment, why does the Search Options menu not also have a "Subscribe to this search" option, which would add another entry in the Search Query box? This is a noticeably different interface than the Thread Options menu.
    [1] Subscriptions & Bookmarks
    http://forums.ni.com/ni/user_subscriptions
    [2] Frequently Asked Questions
    http://forums.ni.com/ni/help_faq
    Joe Friedchicken
    NI VirtualBench Application Software
    Get with your fellow hardware users :: [ NI's VirtualBench User Group ]
    Get with your fellow OS users :: [ NI's Linux User Group ] [ NI's OS X User Group ]
    Get with your fellow developers :: [ NI's DAQmx Base User Group ] [ NI's DDK User Group ]
    Senior Software Engineer :: Multifunction Instruments Applications Group
    Software Engineer :: Measurements RLP Group (until Mar 2014)
    Applications Engineer :: High Speed Product Group (until Sep 2008)
    Solved!
    Go to Solution.

    Hi Joe,
    Thanks for all of the questions and congrats on posting your first question!
    Unfortunately I think all of your questions come from the valid assumption that the search query functionality is more robust than it actually is.  The search query functionality really only serves a single purpose and that is to email you when your phrase has been posted to the forums.  For me, I use it to email me when my name is mentioned in the forums.  It serves this purpose well since I have it set up to work off just a single search term.  However I find that multiple word phrases are combined with an OR which is not as useful.  The search query does not adhere to any common search syntax that you would expect (I believe we are the only community that uses this feature so it has not been improved upon).
    The best way to set up both multiple word queries and multiple different queries is to use the RSS feed as you mentioned.  This way you can tailor your search very specifically using different advanced search options and subscribe to them all in one feed reader without constantly getting emails.  The search query emails do not adhere to the digest subscription settings.  I find that the RSS feeds work very well for searches and I am fond of using them, but I do use an RSS Reader for many things so it is not out of my normal workflow.
    Thank you for reading the Forum FAQ.  I've done some work to improve it but I think it has a long way to go and it's good to know that people read it
    Regards,
    Laura
    Web Support & Operations
    National Instruments

  • Formatted Search Query for BatchNo

    Dear All,
    I am using the following query as formated search for Identifying the batches availble during the creation of  Delivary document
    in a user defined column at row level. When i click on this field it's showing the Batches for the Item with Zero Qty also.
    I need to display only the batches where the QTY >0. This query displaying even the Zero Qty Batches also. Please help me to modify the below query for getting the above. Below is the  query .
    SELECT distinct  T4.[BatchNum] FROM [dbo].[OIBT]  T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN DLN1 T2 ON T1.ItemCode = T2.ItemCode INNER JOIN ODLN T3 ON T2.DocEntry = T3.DocEntry INNER JOIN IBT1 T4 ON T0.BatchNum = T4.BatchNum AND T3.DocNum = T4.BaseNum INNER JOIN OWHS T5 ON T0.WhsCode = T5.WhsCode WHERE T0.[ItemCode] = $[$38.1] AND  T4.[WhsCode] = $[$38.24] AND T0.[Quantity]>=$[$38.11]
    Regards
    Srini

    i removed that T5, But It's  showing the  Batches where the qty in the main warehouse for that batch is Zero.That batch was actually present in another warehouse. And also when i am working on other warehouses it's showing the batches in the main warehouse where the qty is present.
    Regards
    Srini
    Edited by: Srini on May 11, 2010 10:24 PM

  • Formatted Search query for Vacation Accrued

    Hi Experts,
    I have a Client who needs to keep tract on the Vacation Accrued on the Employee Master Data. I have created this UDF on the Master Data, but I could not get the query for the Formatted Search right.
    This Formatted search on the UDF ( must look at the OHEM.startDate field and populate the following:
    If it is a still within year of the system date, it must populate 0,
    If it is > 1 year and < 3 years, it must populate 5,
    etc.
    Any help would be greatly appreciated.
    Marli

    Hi Experts,
    Here is what I did for the query mentioned above:
    {SELECT
    CASE
               WHEN (T0.startDate > GETDATE() -356)
                       THEN 0
               WHEN (T0.startDate > GETDATE() - 712)
                       THEN 5
    END
    As 'Vacation Accrued'
    FROM OHEM T0}
    The issue is that if I link this query to the UDF on the EMD, I get a list of 0 and 5 to choose from. I need to populate automatically.
    Thanks.
    Marli

  • Formatted search query for displaying invoice items details

    hi all,
    i need to display all the items in AP invoice.kindly suggest me a query for that.
    in AP invoice
    Ex. row items
    code--descqtyprice--
    total
    I0001--XXXXXXX5--
    100 -
    500
    query should display this row as
    code--desc--
    price
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    =================================
    the query should display as the qty is 5 so it will display the same item 5 times
    kindly suggest me some query for formatted search
    its very urgent
    regards
    sandip

    Hi Sandip,
    DoQuery("Select b.ItemCode from OINV a,INV1 b Where a.DocEntry=b.DocEntry")
    Hope its help for you
    Give me reward points,
    Regards,
    G.Suresh.

  • Ibatis like api to generate dynamic sql query

    I use hibernate for persistance.Most of my queries are hibernate criteria queries , but some of them are sql queries, I have to generate dynamic queries which are very long , I have been using java to generate queries using lot of if else blocks , this makes debugging query very hard. I am looking something like ibatis where I can write my query in xml and can also provide conditions keep the and readable,but using ibatis I have to use ibatis to execute query, whihc I cannot do becasue I am using hibernate and I donto want multiple api for persistance , what I need is some like ibatis which can generate dynamic queries please suggest me what other use , how to writwe readable dynamic queries ?

    I use hibernate for persistance.Most of my queries are hibernate criteria queries , but some of them are sql queries, I have to generate dynamic queries which are very long , I have been using java to generate queries using lot of if else blocks , this makes debugging query very hard. I am looking something like ibatis where I can write my query in xml and can also provide conditions keep the and readable,but using ibatis I have to use ibatis to execute query, whihc I cannot do becasue I am using hibernate and I donto want multiple api for persistance , what I need is some like ibatis which can generate dynamic queries please suggest me what other use , how to writwe readable dynamic queries ?

  • Proxy to JDBC scenario need dynamic sql query for sender .

    Hi Experts,
    I am developing proxy to jdbc scenario. in this i need to pass dynamic sql query  whre we are passing classical method like below.
    while we are passing select stmt in constant and mapped with access field  and key field mapped with key field.
    MY requirement is like instead of passing select stmt in constant where i can generate dynamically and passed in one field and mapped with access field.

    Hi Ravinder,
    A simple UDF or use of graphical mapping functions in most cases should provide you everything you need to construct a dynamic SQL statement for your requirement.
    Regards,
    Ryan Crosby

  • File name field not generating dynamic file name for report printing

    Hello Folks,
    I have a report region on a page and have enabled report printing. I would like to have the file name generated dynamically. So, I add the substitution string, say "&P1_CUSTOMER_NAME." (no quotes). The output file I get is literally named "&P1_CUSTOMER_NAME..pdf" (no quotes).
    I have seen several posts suggesting the file name field should accept this syntax but, I cannot get it to work.
    We are running Application Express 3.2.0.00.27 and BI Publisher.
    Any suggestions?
    Thanks for your help.
    -Markus B.

    I was finally able to make it work using a page process and the APEX_UTIL.DOWNLOAD_PRINT_DOCUMENT with a submit button.
    -Markus B.

  • Dynamic export query for archiver

    Is there a way to pass custom query at run time and call export_archive method.
    Thing is I do not want to do automatic replication but create batch files on need basis and manually trigger transfer.
    regards,
    deepak

    The query for a ViewObject is either provided at design time (and "lives" in your ViewObject's XML metadata file), or the query can be dynamically set by creating a dynamic view object, as you've noted.
    In the former case, you can set additional where clause restrictions, or set the values of existing or dynamically appended WHERE clause bind variables, however you cannot completely replace the query.
    Are you having a problem using the chart renderer with a ViewObject created dynamically?
    null

  • Search help for search term field in xk01

    hi experts ,
    i searched for the search help fild search term 1/2 in xk01(vendor master data )   in sdn i get note  .
    i followed note done the three steps  sucessfully . now i tested  xk01 transcation  when i press f4 button on sort1 field its give   a message no in put data available .

    Sorry
    perhaps I haven't understood:, you've written:
    i searched for the search help fild search term 1/2 in xk01(vendor master data ) in sdn i get note .
    i followed note done the three steps sucessfully
    What do you mean?  Which steps?
    Max

  • Snow Leopard Dashcode - dynamic data source for search via web API

    I'm making a dual product dashcode project, for safari and mobile safari. I have a dataSource that is a web API that takes a couple of variables to return results in JSON format. When the safari product launches, it's set up to ping the API with a set of parameters and populate an itemsList in my left sidebar. I have a search field above that itemsList. Now I can get the search field to:
    1. take the contents of the search field and construct a new URL from it.
    2. go out and ask for results from pinging the API via an XMLHTTPRequest.
    3. eval the contents and be ready to put it into the itemsList...
    the questions I have are:
    1. Where do I put the evaluated JSON results? DC.dataModel.dataSource.content ?
    2. What's the trigger to get my itemsList to reload the data?
    Here's the relevant search handler function code:
    function mySearchHandler(event)
    // Values you provide
    var searchFieldValue = document.getElementById("search"); // replace with ID of search field
    // Search field code
    searchFieldValue = searchFieldValue.value;
    // Values you provide
    // The feed to fetch
    var feedURL = "http://myurl.com/api.php?searchfortext="+ searchFieldValue + "&resultformat=json";
    var onloadHandler = function() { xmlLoaded(xmlRequest); }; // The function to call when the feed is loaded; currently calls the XMLHttpRequest load snippet
    // XMLHttpRequest setup code
    var xmlRequest = new XMLHttpRequest();
    xmlRequest.onload = onloadHandler;
    xmlRequest.open("GET", feedURL);
    xmlRequest.setRequestHeader("Cache-Control", "no-cache");
    xmlRequest.send(null);
    and then in my xmlLoaded function, I figured it would be something like this:
    function xmlLoaded(xmlRequest)
    if (xmlRequest.status == 200) {
    //' xmlRequest.responseText has what I want in it. Where do I put it? I thought it was here:
    DC.dataModel.dataSource.content = eval(xmlRequest.responseText);
    // or was it here? Neither of these seem to work.
    // DC.dataModel.itemsList.setContent(DC.dataModel.dataSource.content);
    // Then what, get the itemsList.object and tell it to reload itself... ? Doesn't work for me. :-
    document.getElementById("itemsList").object.reloadData();
    else {
    alert("Error fetching data: HTTP status " + xmlRequest.status);
    But... this doesn't work. I can evaluate DC.dataModel.dataSource.content and I can see my new search results sitting there. But I can't get my itemsList to refresh the display and load up what the web API gave it. How does this work in snow leopard dashcode?

    CrashPlan is a beast prone to ruining any other purpose on the server. I'd highly recommend moving it to it's own dedicated machine, like a mac mini. When I use CrashPlan that's my preference.
    You can find more information about mds by looking at it's man page, mds(8) and the man pages of it's related utility mdutil(1). Your mds database is likely corrupt. You have a few options. Wipe and reindex your metadata stores and/or turn indexing off on volumes that you don't need it.
    http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/ 10.6/man8/mds.8.html
    http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/ 10.6/man1/mdutil.1.html
    Gil

  • Formatted Search Query for Variable field

    Hi Experts,
    I have a client who wants a UDF on the Delivery Document to auto populate wiht a Variable field in the Administration module. This variable field was added by a Add-on.
    The system information is:
    Form: ShipOpt
    Item: Boxes
    Pane: 1
    Column: Box Name
    Row: 0
    Variable: 3
    How do you specify a Variable field in the Query?
    Any help would be appreciated.
    Thanks,
    Marli

    Hi Marli,
    You may only use Current form variable for FMS query.  I believe you need UDF on the Delivery. SO the other form will not be available to your query.
    Thanks,
    Gordon

  • Help in search query for schema

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
      I want to get all function name whoes text having  string like  "prm_fn_xyz ( sss , 'O' , rrrr )
       here xvz is not fixed means we can user "%"  for this xyz  , only prm_fn_ is fixed
       and   parameter of this function  (prm_fn_)  should contain atleast capital  "O"
    thanx

    prm_fn_xyz ( sss , 'O' , rrrr )If this is a procedure and is not used dynimically in the code you can query the user_dependencies.
    select *
      from user_dependencies
    where referenced_name like 'PRM/_FN/_%' escape '/'

  • Does the search query for the forums work at all?

    I at the forum through the Adobe Help application.  When I do specific searches of the Illustrator forum, even picking search terms that appear in the opening list of most recent discussions, I get NO search results back. 
    I've expanded the timeframe, and broadened to forums and discussions - nothing back. 
    It this some glitch by coming to this from a Mac?  Very very puzzled. 

    Bob,
    Unfortunately, the search function is a search dysfunction most of the time,and many complanits have been made about it here, in the Forum Comments forum:
    http://forums.adobe.com/community/general/forum_comments
    Here is one of the threads:
    http://forums.adobe.com/thread/823088?tstart=0

Maybe you are looking for

  • How to create a Catalog (Product/Service) & TAX issues

    SRM Guru's Product Ver: SRM 5.0 : ECC 6.0  ( No CCM or Service Master ) TAX S/w: Vertex ( O ) As of now:    We are planning to implement a vanilla SRM-ECC (in ext. classic). We are into Indirect procurement w/limit orders. Catalog: I want to create a

  • How can I see the lyrics of the songs on my IPad as I did on my iPod 5th generation?

    When I use my iPod Classic 5th generation, I could read the lyrics of my songs. How can I read them when using my iPad?

  • Install Medal of Honor: Allied Assault on Mac OS X

    Greetings! I have Medal of Honor instalation CD's since the old Mac OS 9 and it worked. The game was also builted for the Mac OS X and both Aspyr and Apple confirms that it runs on int. However I can't make it run, no matter what! :S So I created thi

  • Lucene search and order by Date attribute

    Hello, We have a requirement where we have to search assets and sort assets via some date attribute (Article Publication Date) using Lucene Search. There is no issue in searching and displaying results in any order we want. Problem occurs when some a

  • Standar IDOC Extension

    Hello Group:         I Need to Extend the Standard Idoc BUPA_INBOUND_MAIN_SAVE_M03.         I created the New Segment with their fields in the WE31.         Now, I want to Create the Extension in the WE30.         But the Error is appearing: