Tags: attributes, certain, database, dear, declarative, encountering, examples, form, guide, handling, inserted, mysql, null, oracle, search, searching, sql, table, uix, value, viewobject

Handling inserted "null" in a search form declarative

On Database » Oracle

3,503 words with 1 Comments; publish: Sun, 10 Feb 2008 17:35:00 GMT; (25062.50, « »)

Dear all,

using the examples from the UIX Developer Guide for searching attributes with a certain value in a table / ViewObject I am encountering the following problem:

When I insert any value in the textInput field and fire the search event, everything works fine and either the values matching the specified criteria are displayed in the table or if none matches, the alternateText is displayed. So far, so good.

But ;

-(:

When I insert "null" to the textInput, I get an exception "Error during statement preparation ..."

Is there any possibility to check declarativly if the user inserted "null" or "NULL" to make some client side validation before submitting the search form?

I think there should be a possibility with regEx, should it?

Thank you in advance

Udo

Here is my code:

-- Form code --

 <

form name="search" method="POST"> <

contents> <

inlineMessage prompt="Search" vAlign="middle"> <

contents> <

stackLayout> <

contents> <

flowLayout> <

contents> <

choice name="attrName"> <

contents> <

option text="Code" value="Code"/> <

option text="Name" value="Name"/> <

/contents> <

/choice> <

textInput name="attrValue" columns="20"/> <

/contents> <

/flowLayout> <

/contents> <

/stackLayout> <

/contents> <

end> <

submitButton text="Go" ctrl:event="search"/> <

/end> <

/inlineMessage> <

formValue ctrl:event="search"/> <

/contents> <

/form>

-- Handler code --

 <

event name="search"> <

bc4j:findRootAppModule name="GlobalService"> <

bc4j:findAppModule name="SystemService1"> <

bc4j:findViewObject name="LiteratureType"> <

bc4j:findByExample> <

bc4j:exampleRow ignoreCase="true"> <

bc4j:exampleAttribute> <

bc4j:nameBinding> <

bc4j:parameter name="attrName"/> <

/bc4j:nameBinding> <

bc4j:valueBinding> <

bc4j:parameter name="attrValue"/> <

/bc4j:valueBinding> <

/bc4j:exampleAttribute> <

/bc4j:exampleRow> <

/bc4j:findByExample> <

bc4j:executeQuery/> <

/bc4j:findViewObject> <

/bc4j:findAppModule> <

/bc4j:findRootAppModule> <

/event>

All Comments

Leave a comment...

  • 1 Comments
    • Try IS NULL instead.

      Have a look at oracle.jbo.ViewCriteriaRow for the supported operators.

      Here are the operators recognized by ViewCriteriaRow: <, >, =, ~, !, LIKE, IS, IN, NOT, NULL, BETWEEN. If an operator is found, no interpretation of the attribute value occurs. I.e., the attribute value is used as is. This means that for a String attribute, one must put "'" around string constants.

      If no operator is specified, for char attributes, the LIKE operator is assumed. For non-char attributes, = operator is assumed. The string constant for LIKE comparison may use "*". "*" is translated to "%".

      Regards, Markus

      #1; Fri, 22 Feb 2008 01:49:00 GMT