Af:query validation?

Hello,
I want to handle client side validation for one of the query criteria rendered inside af:query component , checking that operator can not null
but there is no such thing as validator on af:query component
No , such method addValidator/ setValidator to add custom validator
Is there any way to do this or its not possible?
thank you

not a big fan of doing following everytime..., but it works
so, I have one commandButton, performing some action and I want to validate filter operators for not null
RichQuery is associated with backing bean
unfortunately, you will get hold of the components once the af:Query is Fully Rendered , which is what happening in this case
    public void checkForValidation(ActionEvent event){
        List<UIComponent> richQueryComponents = richQuery.getChildren();
        RichPanelGroupLayout richQueryPanelGroupLayout = (RichPanelGroupLayout) richQueryComponents.get(0);
        List<UIComponent>  richQueryPanelGroupLayoutComps = richQueryPanelGroupLayout.getChildren();
        for(int i=1;i<richQueryPanelGroupLayoutComps.size();i++) {
                 Application application = FacesContext.getCurrentInstance().getApplication();
                 RichPanelLabelAndMessage panelLabelAndMessage = (RichPanelLabelAndMessage) richQueryPanelGroupLayoutComps.get(i);
                 RichSelectOneChoice operSelectOneChoice = (RichSelectOneChoice) panelLabelAndMessage.getChildren().get(1);
                 operSelectOneChoice.setAutoSubmit(true);
                 application.addValidator("OperatorValidator","com.simplyadf.OperatorValidator");
                 Validator validator = application.createValidator("OperatorValidator");
                 MethodBinding methodBindingExpression= FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{pageFlowScope.myBackingBean.filterOperValueChanged}",new Class[]{ValueChangeEvent.class});
                 operSelectOneChoice.setValueChangeListener(methodBindingExpression);
                 operSelectOneChoice.addValidator(validator);
                 operSelectOneChoice.validate(FacesContext.getCurrentInstance());
}Version : JDev11gUpdate2
Component : af:Query
regards,

Similar Messages

  • Flash Chart Series : SQL Query Validation

    Hello,
    I probably found a bug on the SQL Query Validation for Flash Charts, if I have two subqueries, the validation fails:
    SQL Query example:
    SELECT NULL, a, b
    FROM (SELECT c a, d b FROM
    ( SELECT 'first' c, 2 d FROM DUAL))
    Error returned:
    "Failed to parse SQL query:
    ORA-06550: line 1, column 45: PLS-00428: an INTO clause is expected in this SELECT statement"
    Is this problem known or is there just something that I do wrong ?
    Christophe

    Yes it was that problem, but I still have an issue:
    How do I set the Flash Chart to use a PL/SQL function in the first place ?
    When I try to enter:
    "return package.function;" in the Create Region Wizard, I get the following error:
    Failed to parse SQL query:
    return EXPERT.getFullListSQLByNC
    ORA-00900: invalid SQL statement
    Certain queries can only be executed when running your application, if your query appears syntactically correct, you can save your query without validation (see options below query source).

  • Error executing a query (validity interval problem in variable)

    Hi all,
    I have an issue in a query.
    While executing the query  i am getting following error
    "THE VALIDITY INTERVAL HAS THE INITIAL VALUE AS LOWER LIMIT"
    There are two CALMONTH variables that are being used in the query and are also used as selection variables
    1) interval characteristic mandatory variable
    2) single value characteristic mandatory variable
    Please suggest me what might be the problem.
    Any suggestions are welcome.
    Thanks
    Mudit

    Hello,
    I tried debugging my query in RSRT and i have found a possible reason for that.
    My query was built on a multiprovider in which data was not loaded in one of the cube.Since no request was loaded in the infocube initial fields of all time characteristics were empty which was the reason for the error.
    Thanks once again for your valuable inputs.
    Mudit

  • SQL query validation with XML?

    Hi
    Is there anything out there that will validate an SQL statement (validate meaning the SQL statement 'will run') using XML?
    I want to make a servlet that takes SQL and adds it to a java class that will in turn do a bunch of magical things. However
    I need the SQL to be validated before it gets written to the class.
    XML seems like it would be a useful tool to accomplish this but I fear the
    document would be friggen huge and run slow as hell.
    I guess in essence it would be like creating an SQL compiler completely
    out of XML.
    Does something like this exist or is this solution just to broad to realistically consider?

    There is no kind of relashionship between SQL and XML. Moreover, with RDBMs having different flavors of SQL, how can you expect an XML parser to be able to tell you that your query will run on Oracle but non on SQL Server?

  • Query Validation

    Is there any method in JDBC API to verify whether the given SQL query is valid or not.
    The query shouldnot be sent to Database.
    I want to even identify the column names in SELECT clause and table names in FROM clause in the given SQL.

    Thanks Col ! The site u mentioned is useful. I found JavaCC is appropriate for my work. I even downloaded JavaCC. But I could not find SQL parser in the downloaded version. I went through the parser code and found it useful<given in the site>. But I am not able to get information about the sites where I can download it. I even wrote mail to the author of the code [email protected] , but till today I didnot get any respond. Could u help me in this matter.
    Priya

  • Boolean search query validation

    Dear experts,
    My project has to get from the user keywords and pass them to the search engine. The keywords are combine into a boolean query,  using AND, OR, and brackets. I need to write a method that would validate that query, that would return "false"
    if e.g. a boolean operator (AND or OR) is missing, or if a bracket is not closed. For example, these are valid queries:
    Cats AND dogs
    Cats AND (dogs OR rats)
    (Cats AND dogs) OR (mice AND rats)
    Cats AND "brown dogs"
    And these queries are invalid:
    Cats (dogs OR rats)
    (Cats AND dogs) (mice AND rats)
    (Cats AND dogs) OR (mice rats)
    ((Cats AND dogs) OR (mice rats)
    I would appreciate if somebody could help me with this. I suspect Regex might help, but I am very bad at it.
    Thanks

    Hi dpreznik,
    I think Regex should be a good way to validate these kind of strings. But it'll take some time to build and test patterns. I'm not going to give you the exact answer you want, but I'll give you some links that can help you to understand regular expression. Please
    see these documentation for reference, good tutorials for beginners:
    Regular Expression Language - Quick Reference
    How to: Search Strings Using Regular Expressions (C# Programming Guide)
    Also try this thread:
    .Net Regex Resources Reference
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Checking text query validity without actually running the query: ideas?

    Hi,
    I would like to implement a sort of function that does a preliminary check on the validity of the search string and ideally this function should work with both CTXCAT and CONTEXT indexes (and grammars).
    Initially I thought that CTXQUERY.EXPLAIN function could do this for me, but, unless I am missing something, it only works with CONTEXT indexes and it doesn't accept a string containing a text query rewrite using CTXCAT grammar (it throws DRG-11119: operation is not supported by this index type).
    Plan B would be to create an empty table with a CONTEXT index and then run the query either with the CONTEXT grammar or the CTXCAT grammar via query rewrite and if the query runs, returning no rows, presumably fast enough for this purpose, then the query string is assumed to be valid.
    What I don't like much about plan B is the need for an additional table plus the "dummy" context indexes just to perform the parsing of the text query, but so far I didn't come up with more brilliant ideas.
    Any thoughts?
    Am I missing something that does the magic without hassle?
    Thanks
    Flavio

    Under normal circumstances I wouldn't do this, as you say I'd just run the query and catch the error, but I need to do this inside a report refresh performed via AJAX (using Oracle Apex) and the catch is that when such refresh fails owing to a syntax error, the partial refresh mechanism of APEX becomes broken, so even if you amend the query and submit a new valid string, it won't show up any more.
    That's why I need to be sure that the string is valid before running the query, hence the syntax checking function.
    The google-style parser sounds interesting, may be I can try to implement it in a future release of my app!
    Thanks
    Flavio

  • How to display an error message after validation in Formatted Search?

    Hi SBO experts,
    if an error is detected on validation in a Formatted Search, how to display an error message to the user entering the data?
    Thanks & Regards,
    Raghu Iyer

    i created a formatted search query & attached it to the field 'Quantity' at Line Item level in Sales Order screen. just for testing purpose, i eneterd the following code lines in the query validating 'Quantity'
    if $[$38.11.0] > 50
    begin
    select @error = 1
    select @error_message = 'Vendor code cannot begin to X sign.'
    end
    the system throws the error : Internal error (8180) occurred [Message 131-183]
    actually, i need to display an error message to the user if Quantity is not in multiples of the OITM.SalFactor2
    if $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0]) > 0
    begin
    select @error = 1
    select @error_message = 'Error in Quantity.'
    end
    but, this expression to get the remainder itself seems to have some error
    $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0])
    i guess, % operator is used for modulo (to find the remainder of one number divided by another.) ? am i right ?
    Regards,
    Raghu Iyer

  • Retrieve a range of records from SQL query Oracle

    I want to retrieve range of rows in Oracle database. This is the table structure:
    CREATE TABLE ACTIVESESSIONSLOG(
      ASESSIONID VARCHAR2(30 ) NOT NULL,
      USERID VARCHAR2(30 ),
      ACTIVITYSTART TIMESTAMP(6),
      ACTIVITYEND TIMESTAMP(6),
      ACTIVITY CLOB
    /This is the SQL command that I use to get rows from the table:
    SELECT * FROM ACTIVESESSIONSLOG WHERE ROWNUM >= 5 AND ROWNUM <= 10 ORDER BY USERID ASC;When I rum it no data is displayed. What is the proper way to get only 5 rows from the database?
    Best wishes
    Peter

    Is this SQL query valid?I tend to say no: ORDER BY is applied last, so your rownum is not in correct anymore:
    SQL> select rownum, ename, empno from emp order by empno
        ROWNUM ENAME           EMPNO
             3 SMITH            7369
             4 ALLEN            7499
             5 WARD             7521
             6 JONES            7566
             7 MARTIN           7654
             8 BLAKE            7698
             9 CLARK            7782
             2 SCOTT            7788
            10 KING             7839
            11 TURNER           7844
            12 ADAMS            7876
             1 JAMES            7900
            13 FORD             7902
            14 MILLER           7934
    14 rows selected.You either use analytic ROW_NUMBER() as in my previous post - or you need to nest once again:
    SQL> select rn, empno, ename
      from (select rownum rn, ename, empno
              from (  select ename, empno
                        from emp
                    order by empno))
    where rn between 4 and 5
            RN      EMPNO ENAME    
             4       7566 JONES    
             5       7654 MARTIN   
    2 rows selected.

  • 1.6 LOV query invalid, was working in 1.5

    The following LOV query was valid in 1.5:
    select rd.name, rd.refdata_id from refdata rd, refdata_meta meta where meta.name = 'Title' and rd.refdata_meta_id = meta.refdata_meta_id and (:20_PATIENT_ID IS NOT NULL OR visible = 'Y') order by rank
    This query is being flagged as invalid in 1.6. The problem appears to be the parenthetical OR clause, since taking it out passes validation. The error message is:
    "LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query."
    Seems to me that the validator is equating the existence of a left parenthesis with an inline query, which of course is incorrect as the above perfectly valid SQL demonstrates.
    The query with the OR clause operates to populate the LOVs just fine in my existing app migrated from 1.5, so this is a maintenance and new app creation issue.
    I can of course work around it by views as needed to support a simplified LOV query, but I would much rather just get the former level of functionality back. Any prospect of fixing what appears to me to be a bug in the LOV query validator for the 1.6 platform?
    thanks,
    susan weber

    Susan,
    In 1.6, we introduced LOV query validations, to help head off problems before runtime. Looks like in this case, the check has a bug. It's trying to parse your SQL as if it were a query in a region and it fails because of the item name you are using that begins with a numeric digit and is followed by non-numeric characters. Such a query fails to parse with DBMS_SQL.PARSE. But the query does work, as you know, in an LOV, where EXECUTE IMMEDIATE with a USING clause handles it okay.
    So we have three bugs, the LOV query validation algorithm, the misleading validation failure message, and the bug that allows users to create and use items with names that are not valid Oracle identifiers. Thanks for pointing this out.
    Your workaround is to use v('20_PATIENT_ID') instead of using bind variable notation.
    Scott

  • How to validate a Query without executing it?

    How to validate a Query without executing it?
    For example if I have:
    ReadAllQuery myQuery = new ReadAllQuery(myClass);
    myQuery.setSelectionCriteria(myExpression);
    What can I do to have must validation as possible been done before executing the query?
    Validation that could be done are:
    - Expression reference fields that really exist in TopLink mapping
    - Literal provided to expression are of compatible type
    - Parameter setting set against the query are all compatible

    Your could prepare the query.
    query.prepareCall(session, record);
    This will do all query validation and generate the SQL for the query.

  • Import - Validation

    Hello All,
    I have a query regarding import workflow validation.
    I want to validate record while importing from import manager. I have created a Import workflow but i am making some mistake so workflow is not properly functioning.
    Rqmnt - i have 3 fileds in main table in which 1 is mandatory. If i import records in bulk and configure validation thru import workflow what will be steps. and how it will function or will show results if i left this field mandatory in source file.. ( step by step workflow)
    Also one more query Validations can not be applied to tuple.. correct me if i am wrong.
    Rgds
    Himanshu

    Hi,
    First go to the matching mode in data manager, there select the tuple name from dropdown available on left side pane in Validation tab. After selecting tuple, you can create validation at tuple level. It is for SP02. In SP01, u can find validation through menu path "Records-Validations-Tuple Validations".
    Regards,
    Prashant
    Edited by: Prashant Malik on Oct 1, 2009 10:06 AM

  • Error in Testing SQL Query VO

    Hi,
    I have a a VO based on a Database Table 'XXCZ_TEST_V'(View in APPS schema)
    The table(view) present in APPS schema is based on several base Tables in XXCZ schema.
    When I test the Query in the Wizard it shows following error int he "Detailed Screen"
    java.sql.SQLException: Invalid column index: getValidColumnIndex
    While testing the VO output in BC4J tester I get followig error
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: Select * from XXCZ_TEST_V
    Note : The query Select * from XXCZ_TEST_V works fine in SQL client or TOAD.
    How can i correct it?
    Thanks,
    Gowtam.

    Hi Srini,
    I am facing a strange behavior in the wizard.
    When i test the query in the Wizard i get[b] "Query Valid".
    If I open the Edit VO and then click test, still I get "Query Valid".
    but when I click Apply I get an SQL error.
    and BC4J tester also throws an SQL error.
    The query is
    Select * from XXCZ_MODELS_V
    First time It works fine..
    Then If I edit it to select Model_code,Model_name from XXCZ_MODELS_V I get the error.
    And now, again if Edit the query back to Select * from XXCZ_MODELS_V,surprse...again an error..
    I am not able to understand the error..as It executes perfectly fine in SQL client
    Everytime I am deleting the VO and creating again with select * query...
    Should I delete the VO everytie if i want to change the Query
    Thanks,
    Gowtam.

  • OBIEE direct DB request query sql statement cannot be edited after saved

    I have created direct DB request with long complex query, validated sql and Results appears ok. After I save this request and go back to edit the SQL statement, the original statement is only partially visible. Basically I can not do edit.
    Is there any Query related buffer or other configuration parms I have to set up?

    I'm not sure what the deal is between Flex/AIR and Visusal Studios, but i descided to publish my webservices and point the wsdl there instead of using the visual studio generated one.
    AND BEHOLD
    I't worked and worked much much faster than i was anticipating.
    So i'll just chalk it up to poor communication between FLEX and VS.  But if anybody knows a more complete answer I would still love to hear it.

  • LOV Query is "invalid" all of a sudden...

    The query below was written a while back (I've been through several APEX upgrades since then). I recently went in to the LOV Definition to make some changes and found that, no matter what I do, I get the error:
    "LOV query is invalid, a display and a return value are needed, the column names need to be different..."
    This is even true if I make no changes to the Query but try to "Apply Changes". I'm guessing that an upgrade someplace along the line is causing this.
    Any ideas on how to make this query valid once again?
    (APEX 3.1)
    Thanks!
    Alex
    SELECT 'ES Value of ' || TO_CHAR(round(ve_value,-2),'$99,999,999') d, 'ES' c
    FROM QUERY_MAIN qm
    WHERE query_id = nv('P310_QUERY_ID')
    AND subject_propid = nv('P309_BLS_PROPID')
    AND nvl(ve_value,0) > 0
    UNION
    SELECT 'PV Value of ' || TO_CHAR(round(Bluelime_Common.get_perfect_value(nv('P309_BLS_PROPID'), NULL, NULL, TO_DATE(:p0_base_date, 'MM/DD/YYYY')),-2),'$99,999,999') d, 'PV'
    FROM dual
    where TO_DATE(:p0_base_date, 'MM/DD/YYYY') != trunc(sysdate)
    UNION
    SELECT 'PV Value of ' || TO_CHAR(round(Bluelime_Common.get_perfect_value(nv('P309_BLS_PROPID')),-2),'$99,999,999') d, 'PV'
    FROM dual
    where TO_DATE(:p0_base_date, 'MM/DD/YYYY') = trunc(sysdate)
    or :p0_base_date is null

    Have you tried this:
    SELECT disp_val d, ret_val r
      FROM (SELECT    'ES Value of '
                   || TO_CHAR (ROUND (ve_value, -2), '$99,999,999') disp_val,
                   'ES' ret_val
              FROM query_main qm
             WHERE query_id = nv ('P310_QUERY_ID')
               AND subject_propid = nv ('P309_BLS_PROPID')
               AND NVL (ve_value, 0) > 0
            UNION
            SELECT    'PV Value of '
                   || TO_CHAR
                         (ROUND
                             (bluelime_common.get_perfect_value
                                                           (nv ('P309_BLS_PROPID'),
                                                            NULL,
                                                            NULL,
                                                            TO_DATE
                                                                   (:p0_base_date,
                                                                    'MM/DD/YYYY'
                              -2
                          '$99,999,999'
                         ) disp_val,
                   'PV' ret_val
              FROM DUAL
             WHERE TO_DATE (:p0_base_date, 'MM/DD/YYYY') != TRUNC (SYSDATE)
            UNION
            SELECT    'PV Value of '
                   || TO_CHAR
                         (ROUND
                             (bluelime_common.get_perfect_value
                                                            (nv ('P309_BLS_PROPID')
                              -2
                          '$99,999,999'
                         ) disp_val,
                   'PV' ret_val
              FROM DUAL
             WHERE TO_DATE (:p0_base_date, 'MM/DD/YYYY') = TRUNC (SYSDATE)
                OR :p0_base_date IS NULL)Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for