Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: SetSessionVar Not Storing Logical Values

$
0
0
Re: SetSessionVar Not Storing Logical Values
Web Connection 5.0
Re: SetSessionVar Not Storing Logical Values
Feb. 27, 2013
02:38 pm
3Q50VE7N5Show this entire thread in new window
Gratar Image based on email address
From:Roy M
To:Rick Strahl
Rick, ( this is resend ... i sent my reponse to myself :) )

as a follow up your changes did not solve the problem ... here the code and what it does it fails the 'IF ATC( "...." statement and heads towards the else statement ... Here it fails again based on the check for empty()

IFATC("<"+lcVarName+">",loData.vars) > 0 lcExtract=Extract(loData.Vars,"<" + lcVarName + ">","</" + lcVarName + ">",,.t.)IFEMPTY(lcValue)*** Remove the entryTHIS.oData.Vars = STRTRAN(loData.Vars,"<"+lcVarName+">"+lcExtract+"</"+lcVarName+">"+CHR(13),"")ELSE*** Kill the existing one and replace it with the new oneTHIS.oData.Vars = STRTRAN(loData.vars,"<"+lcVarName+">" + lcExtract + "</"+lcVarName+">"+CHR(13),lctext) ENDIFELSE*** Simply append itIF !EMPTY(lcValue)THIS.oData.vars = loData.Vars + lctextENDIFENDIF

Should I stay with my changes or do you have something else up your sleeve?



Roy,

The problem is that SetSessionVar() checks for EMPTY(lcValue) and .F. translates to empty as does 0.

I've changed the code:

IFPCOUNT() < 2 lcValue = ""ENDIF

which should avoid this problem.

FWIW, SetSessionVar() accepts values of any type, but when you use GetSessionVar() you only get back a string. Session effectively works only with string values so on the out end you're responsible for converting back to whatever type you had to start with.

+++ Rick ---


VFP Version: 8 Wconnect Version 5.63

I am attempting to store a variable into the wsession table. Code below:

session.setSessionvar('admin',this.oUSERSECURITY.oUser.Admin)

This does not record the variable in the wsession table. However, a numeric value is stored see code below:

session.setSessionvar('logoncount',this.oUSERSECURITY.oUser.logoncount)

Am I to assume that logical values must be converted before storing them in the session table?

From the SetSesionVar function there is a check done on the the value ... if empty(lcvalue) ... lcvalue is recorded with "". When a numeric value is passed ... all seems to work well ...

Debug screen shows the test for empty(lcvalue) as .T. and then store "" into lcvalue. As a result of this the variable is not stored with the session

<span style="{font-size: xx-small; color: red;}">Code parsing for language: "'VFP" is not currently supported.<br></span>
FUNCTION SetSessionVar
LPARAMETERS lcVarName, lcValue
LOCAL lctext, lcValue, lcOldAlias, loData

lcVarName = lower(lcVarname)

loData = THIS.oData

IF EMPTY(lcValue)
   lcValue = ""
ENDIF   




Viewing all articles
Browse latest Browse all 10393

Trending Articles