CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 SQL Parameter/Session Type

Print topic Send  topic

Author Message
roscoerush

Posts: 3
Posted: 06/09/2008, 2:41 PM

I am having problems with an SQL Parameter of type Session.

My project is a single page Java Servlet, Running on JBOSS using JIFS to authenticate the user.

The page has an editable grid, in the before build select, I have the following custom code:

e.getPage().getRequest().getSession().setAttribute("RequestUserID", e.getPage().getRequest().getRemoteUser().substring(e.getPage().getRequest().getRemoteUser().indexOf("\\\\")+1));

On the form, I have a label that displays the session variable successfully and also on the page footer ( includeable page). So I know the session variable is being set.

Label Control source type: CodeExpression
Label Control source: e.getPage().getRequest().getSession().getAttribute("RequestUserID")

My editable grid query is by 'SQL' (not table or procedure) and has a where clause like:

WHERE SP.UserID = '{param_userid}'

The SQL parameter is setup like:

Name: param_userid
Type: Session
Source: RequestUserID

From the debug output the JBoss server, the where clause is:

WHERE SP.UserID = ''

The Session variable is not being picked up. I have tested the query with a hard-coded user id and it works correctly.

What have I missed in setting up a SQL session parameter?




View profile  Send private message
mrachow


Posts: 509
Posted: 06/10/2008, 1:26 AM

A remark only.

Sometimes it seems to me that a session variable is tried to read back before ist is set/written.
What I would try in your case is to set the session variable inside a loop until you can read back its value. Maybe you can check the number of times you have to set/write until you get back your User ID.
_________________
Best regards,
Michael
View profile  Send private message
roscoerush

Posts: 3
Posted: 06/10/2008, 5:55 AM

In the before build select code I added an immediate get session variable and set it to a new session variable GET.

e.getPage().getRequest().getSession().setAttribute("RequestUserID", e.getPage().getRequest().getRemoteUser().substring(e.getPage().getRequest().getRemoteUser().indexOf("\\\\")+1));
e.getPage().getRequest().getSession().setAttribute("GETRequestUserID",e.getPage().getRequest().getSession().getAttribute("RequestUserID"));

In the footer I retrieve both session variables and they are the same. It seems the session variable is being set.

Is there a trick to using a session variable in a sql parameter? is it retrieving from the same session store?
View profile  Send private message
roscoerush

Posts: 3
Posted: 06/10/2008, 6:47 AM

After further tests; using SessionStorage.getInstance(e.getPage().getRequest()) in place of e.getPage().getRequest().getSession(). The behavior is the same.

You are correct, there is a problem with the session sql parameter retrieval.

The initial view of the page has an empty/null string for the session variable in the sql parameter, if I refresh the page, the the 2nd pass through does retrieve the set session variable value.

Even though I can immediately retrieve the session variable and set it to another session variable in the 'before build select' event. It seems that the sql parameters have already been set/retrieved prior to the call of the 'before build select' action.

Is there somewhere else I can set session variable that will be before the form is processed?
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.