Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Active forums

Active Forums RSS September 02, 17:37
Style properties

August 31, 21:46
antrun not found

August 31, 14:12
WCB customprofile

August 31, 12:10
End of flow not doing its job

August 24, 12:37
Sort mediaItem by expiration date

 All Forums...


QueryToSessionHandler - How can I get it to work?

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.

Answered
Not marked as answered yet

Forums  >  GX WebManager Usage  >  QueryToSessionHandler - How can I get it to work?


Author QueryToSessionHandler - How can I get it to work?
Cthulhu



Posts: 198

Posted: 16-11-2009 15:13

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)

williamb



Posts: 234

Posted: 16-11-2009 22:32

Hi Cthulhu,

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.

Does this help you?

Cthulhu



Posts: 198

Posted: 01-12-2009 16:31

Yes, that hits it spot on.

Now I only have a few questions left:

* 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):

http://i45.tinypic.com/dyksn5.png

williamb



Posts: 234

Posted: 01-12-2009 19:24 Solved

Hi Cthulhu,

1. How about '%' + ? + '%' :)
2. Try prefixing the sessionkey with GX_

Hopefully both will do the trick :)

-William



Cthulhu



Posts: 198

Posted: 02-12-2009 12:54

Yes, that didst do ye trick. Thanks bunches. Can I ask you to extend the documentation for this handler's usage? =D

williamb



Posts: 234

Posted: 02-12-2009 20:07

I bet that one of them reads this forum :D

patricka



Posts: 255

Posted: 03-12-2009 10:34

Probably, but your best bet is to create a Jira issue for it.

Greetings,

Patrick

Cthulhu



Posts: 198

Posted: 03-12-2009 13:43

Now if I only had access to that thing... =D

(Maybe later this month, not sure atm)

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?

Back to top

New message: "QueryToSessionHandler - How can I get it to work?"
Message:
bold boitalicd underline url quote code smile cool eek grin mad razz sad wink
 
© 2010 GX creative online development B.V.

Disclaimer

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.