NetTalk Central

Author Topic: SetSessionValue will rounds the results  (Read 2897 times)

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
SetSessionValue will rounds the results
« 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

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: SetSessionValue will rounds the results
« Reply #1 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
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: SetSessionValue will rounds the results
« Reply #2 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

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: SetSessionValue will rounds the results
« Reply #3 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

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: SetSessionValue will rounds the results
« Reply #4 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