embedding functions in query

X-Application Version: 3.1.2
Tamino Version : 3.1.1.4
Platform : Win2k …
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

Hi,

I would like to use my homegrown server extension query function in an x-application query:

[myfunc (“string-from-form-field”, /Question, n1, n2, n2)> 30]

Where “string-from-form-field” is the string that’s submitted, /Question is an Element and n1,n2,n3 are fixed integer values.

Is there a chance to invoke my function using the standard query-functionality of x-application - or will I have to try and do it with “directcommand”?

Thank you,

Ralf.

Hello,

with the next version 3.1.3 I don’t see any problem to integrate your query expression although it contains the invocation of a Tamnio Server Extension (SXS).

For the current version 3.1.2 I don’t known a way how to merge it with coding of the input fields which is based on

query(path,operator)

With a directcommand it should be possible to use your query. You can use the attribute queryparm directly

querypam="myfunc (“string-from-form-field”, /Question, n1, n2, n2)> 30"

if n1, n2, 30 are fix values.

Or, you can use

queryparm="USEBODY"

and create the filter expression within the body of the directcommand using JSP tags or Scriptlets.

Bye,
Christian.

Hello Christian,

“USEBODY” does the trick! Thanks a lot!

One little thing is remaining, could you pls help once more?

I need an “and” - query. As long as the second part of the query (a keyword) contains a “real” value (one that can be found in the document), everything is fine.

But if I select a keyword from the select-control holding the keyword-values that is not in the document (“All”), nothing is selected - as expected. So, how can I get rid of the second part of the query, if e.g. “All” is selected as keyword?

Or some kind of tag/scriptlet/whatever that lets me choose between two queries, one with both parts if there is a valid keyword and another one holding only the first part?


<bdm:directcommand type = “query” schema = “testcase1” queryparm = “USEBODY”>
/testcase1/Frage[nGram.nGram3N(’<% out.print(pageContext.getAttribute(“TFrageWert”)); %>’, /testcase1/Frage, 3, 0, 0) >=
<% out.print(pageContext.getAttribute(“DPraezisionWert”)); %>

and /testcase1/Stichwort = ‘<% out.print(pageContext.getAttribute(“DStichwortWert”)); %>’]

</bdm:directcommand>

Thanks again,

Ralf.

Christian,

sorry for interrupting again - but I found the solution (simply adding an “OR” - condition giving “true” when “All” is selected.

Will there be a way to initialize - controls so they show a pre-set value in 3.13? Or do you know a way of doing it? I had a look at selecttag.java but couldnt even find where the <option s are generated.

maybe someone came across the same problem and would like to share the tag?

Thank you, Ralf.

Hello,

just advertising the next version of X-Application 3.1.3: using this version you could create a query page like this

<BR><form action=?post? ...><BR><BR><input type=?text? name=?TFrageWert?/><BR><input type=?text? name=? DPraezisionWert?/><BR><select name=?DStichwortWert?>...</select><BR>...<BR><xapp:setvar name=?nGramFilter? scope=?session? default=??><BR>    [nGram.nGram3N(?${TFrageWert$}?, /testcase1/Frage, 3, 0, 0) >= ${DPraezisionWert$})]<BR></xapp:setvar><BR><BR><xapp:setvar name=?stichWortFilter? scope=?session? default=??><BR>    [./Stichwort = ?${DStichwortWert$}?]<BR></xapp:setvar><BR><BR><xapp:action type=?query? arg=?/testcase1${nGramFilter$}${stichWortFilter$}?><BR>    <input type=?submit?/><BR></xapp:action><BR><BR></form><BR></pre><BR><BR>The evaluation mechanism of X-Application for variables allows you to define a default value. If the ?DStichwortWert? is not set, the second filter is empty.<BR><BR>For the current version 3.1.2 you could check the value of the ?DStichwortWert? via Scriptlet.<BR><BR><pre class="ip-ubbcode-code-pre"><BR><bdm:directcommand type = "query" schema = "testcase1" queryparm = "USEBODY"><BR>/testcase1/Frage[nGram.nGram3N('<% out.print(pageContext.getAttribute("TFrageWert")); %>', /testcase1/Frage, 3, 0, 0) >= <BR><% out.print(pageContext.getAttribute("DPraezisionWert")); %><BR><% <BR>    if (...) {<BR>        out.print(?and /testcase1/Stichwort = ? + pageContext.getAttribute("DStichwortWert"))<BR>    }<BR>%><BR>...<BR>



Within the if expression you can check the value of the select parameter or the value of ?DStichwortWert? if it is valid to define the ?and? expression.

Does this help you?

Bye,
Christian.

Hi Christian,

yes, your suggestion helps. I found a solution
that works, but I guess it puts more load onto the server because the query is more complicated the way I did it. So I’ll try it your way. It’ll be “cleaner” with 3.1.3, but it works in 3.12 anyway.

Still: So far I haven’t found a solution to the -Problem:

I want the drop-down control to be initialized to a given value.

I tried to build the whole control “by hand”

<select …>





But I want (i.e. need) the “distinct”-feature of selectag/fillselect (XQL doesn’t offer “distinct”, I guess?)

Any idea? I think the best way would be a “selecttag”, that takes another parameter: “currentvalue”. If this value occurs in the list, the corresponding option is selected.
Anything in the line for 3.1.3?

Thank you,

Ralf.