*** Solved***Passing session variable inside DRW (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


mylu -> *** Solved***Passing session variable inside DRW (3/7/2007 16:46:03)

Anyway to pass a session variable inside FP DRW?
Futher explanation. in creating a results view i want to be able to search a DB with a session variable created by the user loging in.

Under DRW more options|Criteria add a value like <%response.write "accountid" %>

Needless to say just that code alone does not seem to work beciouse it does not read the session to write it. I've tried using combinations or these commands

<%response.write "accountid" %>
<%=Session(appName&"x_spare")%>

This data is on the opening customer page that allows them a snapshot of what thier account is doing as they log in. I don't want to make them click a form button to pass the variable.

If I make the value static, something like DSS, then all works well of course but then I have to make a home page for each customer when I would reather just have one home page for them with dynamic data.


Thanks!




BeTheBall -> RE: Passing session variable inside DRW (3/7/2007 18:33:54)

Create the page using a static value. Then, diet the code. Then edit the SQL to something like this:

fp_sQry = "SELECT * FROM tableName WHERE fieldvalue ="& Session(appName&"x_spare")

That oughta do it.




mylu -> RE: Passing session variable inside DRW (3/8/2007 10:57:25)

I think I need to clerify, Or I don't understand.

The SQL qry is a view in the DB. It pulls data from 4 tables to capture all the fields we need to display. It it used in multiple reports to eliminate the need to create multiple views for multiple reports.

In the past we simple used static values to pass to the view to pull the data. But as we gained more and more clients that want to use the system we had to create more home pages. One for each client. This of course is not very dynamic and is not scaleable.

It looks like your example is to be writen into DRW in the custom qry page?

Thanks




BeTheBall -> RE: Passing session variable inside DRW (3/8/2007 12:27:04)

Yes, what I posted above would be the query used in the DRW. What is the query you are currently using?




mylu -> RE: Passing session variable inside DRW (3/8/2007 15:07:21)

Here is an example. Ths is a view in the DB

SELECT dbo.tblServiceOrders.DateClosed, dbo.tblServiceOrders.ContractNumber, dbo.tblReps.RepName, dbo.tblAccounts.AccountName,
dbo.tblAccounts.AccountID, dbo.tblAccounts.Address1, dbo.tblAccounts.Address2, dbo.tblAccounts.City, dbo.tblServiceOrders.SONumber,
dbo.tblServiceOrders.BriefDescription, dbo.tblServiceOrders.ContactPhone, dbo.tblContacts.ContactName, dbo.tblServiceOrders.DateOpened,
dbo.tblServiceOrders.TimeOpened, dbo.tblServiceOrders.Status, dbo.tblServiceOrders.SOType, dbo.tblServiceOrders.Reference,
dbo.tblServiceOrders.GeneralSymptoms, dbo.tblServiceOrders.VerifiedDate, dbo.tblServiceOrders.GeneralResolutions
FROM dbo.tblAccounts INNER JOIN
dbo.tblServiceOrders ON dbo.tblAccounts.AccountNumber = dbo.tblServiceOrders.AccountNumber INNER JOIN
dbo.tblContacts ON dbo.tblServiceOrders.ContactNumber = dbo.tblContacts.ContactNumber INNER JOIN
dbo.tblReps ON dbo.tblServiceOrders.TechAssigned = dbo.tblReps.RepNumber




BeTheBall -> RE: Passing session variable inside DRW (3/8/2007 15:42:43)

OK, but you still need a query in the DRW to access the view, right? For example:

SELECT * FROM NameOfView WHERE AccountID ="& Session(appName&"x_spare")




mylu -> RE: Passing session variable inside DRW (3/8/2007 16:14:40)

Correct. I would like to add that statement to more options | criteria | add criteria |value
SELECT * FROM OpenServiceOrderstech WHERE AccountID ="& Session(appName&"x_spare")

But I get no records returned.




BeTheBall -> RE: Passing session variable inside DRW (3/8/2007 16:29:01)

So if you look at your page right now in html view, what is the SQL being used?

I don't think you can get FP to accept the query I have suggested. You would have to put in a generic query, save the page, diet the page and then manually edit the SQL statement.




mylu -> RE: Passing session variable inside DRW (3/8/2007 17:11:27)

The sql qry's are all on the sql server we just pass a session or variable to the server then read it on the page.
The only coding on the page is the FP asp code. I.E.

fp_sQry="SELECT * FROM closedtoday WHERE (AccountID = 'DSS') ORDER BY SONumber DESC"

Which of course you can't modify.

"closedtoday" is another sql qry on in the db.




BeTheBall -> RE: Passing session variable inside DRW (3/8/2007 17:59:14)

Yes, you can modify it. As stated, diet the code using this macro:

http://www.frontpagewebmaster.com/m-279509/tm.htm

Then, you can change:

fp_sQry="SELECT * FROM closedtoday WHERE (AccountID = 'DSS') ORDER BY SONumber DESC"

to:

fp_sQry="SELECT * FROM closedtoday WHERE (AccountID = '"&Session(appName&"x_spare")&"') ORDER BY SONumber DESC"




mylu -> **issue resolved** Passing session variable inside DRW (3/9/2007 12:41:28)

A beast walks out of the woods and looks to sky to be enlightned becoming a man....

Very cool that works great!

Thanks for all your help!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125