The "GX WebManager Usage" forum covers all topics concerning the actual usage of GX WebManager. Topics include using editor functions, content elements, workflow, authorizations, My WebManager, Media repository, Personalization, Page templates, etc.
Here's the situation. I'm trying to implement a database search (or well, a hybrid database search / webservice search, but that's a tale for another day), and to do this, I'd like to use the QueryToSessionHandler.
However, the documentation on this handler is sketchy at best (see GDX0053). It does make note that you need to supply a 'formpartcode' parameter, "for which the form values should be set as arguments for the query."
It might be my English is terrible, but I'm more inclined to believe that I just Don't Get It™.
Simple question: How do I get a number of parameters (3) from my form to a specified location in the query?
(And if not from my form, then from the session - an extra step to store the form data into the session is easy enough)
I'll explain it in a couple of simple steps, maybe that will clear some things up:
1. Create a 'afhandeling' rule with the QueryToSessionHandler 2. Add three 'parameters' that have 'formpartcode' as code, and Formpart as type. E.g. 'name','address','postalcode' 3. Connect the correct database under resources 4. Under `specific parameter` add the code 'query' with the following 'parameter' 'SELECT something WHERE name=? AND address=? AND postalcode=?
Also add `key` e.g. 'thekey' Also add `sessionkey` eg. GX_thekey Also add `tupletag` e.g. tuple also add `sqlexceptionmessage` eg. sorry
Now: 1. Create a form 2. Add three text-input elements on it 3. Add the rule in the flow 4. Click on the rule, add the 3 elements you just created to the parameters...
With /web/show/id=....?xmldebug=true (after logging in with a tomcat wmadmin-role) you can see if the data you tried to get is now available in your session.
You can use /web/admin/log with the QueryToSessionHandler connected to see if the SQL goes correct.
* How would I include this in a "LIKE '%?%'" query? The QueryToSessionHandler (or well, JtdsPreparedStatement) complains that there's an invalid parameter index 1. Escaping, perhaps?
* I see that the QueryToSessionHandler finds a result (two, even), but I can't find it in the XML debug screen. Anything I forgot to fill in? Here's my current settings (for testing, mainly, but it works with specific search terms. I'll write the proper query (with fulltext and the like) once this works):
Edit: Right, I have it in the session now (after prefixing it with GX_), just one more question. Currently, the search results are in the root level (or, root/system), one for each search result, under the element speicified by the tupletag parameter in the configuration. Isn't it supposed to go under its own session key in there somewhere? Or am I only supposed to fill in one of the two (key and sessionkey) parameters instead of both?
This website (GXdeveloperweb.com) may discuss or contain opinions,
(sample) coding, software or other information that does not include GX
official interfaces, instructions or guidelines and therefore is not
supported by GX. Changes made based on this information are not
supported. GX will not be held liable for any damages caused by using
or misusing the information, software, instructions, code or methods
suggested on this website, and anyone using these methods does so at
his/her own risk. GX offers no guarantees and assumes no responsibility
or liability of any type with respect to the content of this website,
including any liability resulting from incompatibility between the
content of this website and the materials and services offered by GX.
By using this website you will not hold, or seek to hold, GX
responsible or liable with respect to the content of this website.