NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Robert Iliuta on August 09, 2017, 01:31:27 AM

Title: SetSessionValue will rounds the results
Post by: Robert Iliuta on August 09, 2017, 01:31:27 AM
Hallo!


I discovered:

p_web.SSV('PEN:Zecime', (p_web.GSV('PEN:PensiaBaza')*10)/100)

is not the same with this

PEN:Zecime = (p_web.GSV('PEN:PensiaBaza')*10)/100

Example:

PEN:PensiaBaza = 1786

1.The results of first code will be 179
2.The results of second code will be 178

Data type of PEN:PensiaBaza and PEN:Zecime is Long @n_10

Why SetSessionValue calculate this way and rounds the results? Is this a bug?


Thank you!
Robert
Title: Re: SetSessionValue will rounds the results
Post by: Rene Simons on August 09, 2017, 02:43:04 AM
Hi,
Clever find but I woul use the SSV method just for storing a value in the session value queue.
Not for calculating purposes.
Rene
Title: Re: SetSessionValue will rounds the results
Post by: Bruce on August 09, 2017, 04:37:04 AM
PEN:Zecime is a long ( so throws away everything after the decimal point.)

p_web.SSV('PEN:Zecime' is a string, so doesn't.

So no, it's not a bug. It all depends on what you do with those values -

>> 1.The results of first code will be 179
>> 2.The results of second code will be 178

you aren't showing how you _investigate_ those results - but that will come into play.

cheers
Bruce
Title: Re: SetSessionValue will rounds the results
Post by: Robert Iliuta on August 09, 2017, 05:23:01 AM
Hallo Bruce!


I'm in a form and I need to do some calculations... When I open the form all values are stored in sessions.
This way I would like to avoid local variables for calculations but if this is the only way... I will do it.

I know I can do p_web.SessionQueueToFile but it is safe to do this when I open the form?

Thank you!
Robert
Title: Re: SetSessionValue will rounds the results
Post by: Robert Iliuta on August 09, 2017, 05:26:24 AM
Hallo Rene!


>Clever find but I woul use the SSV method just for storing a value in the session value queue.
Me too :-)

>Not for calculating purposes.

But when you open a form all values are stored in session queue... then how do you do calculations?

Robert