# Re: [qftestJUI] Calculate with data from the database in a server script

• Subject: Re: [qftestJUI] Calculate with data from the database in a server script
• From: Laurent Dolle <ldolle@?.com>
• Date: Thu, 9 Nov 2006 11:47:04 +0100

Hello,

listOfTuples = [(1.0, 0.0), (2.5, 100.0)]

tuple1 = listOfTuples[0] #(1.0, 0.0)
tuple2 = listOfTuples[1] #(2.5, 100.0)

x = tuple1[0] #1.0
y = tuple1[1] #0.0
z = tuple2[0] #2.5
w = tuple2[1] #100.0

rc.logMessage('x=%f y=%f z=%f w=%f' % (x, y, z, w))

if ((x*y + z*w) != 250.0):
rc.logError('Uncorrect value (%f)!' % (x*y + z*w))
else:
rc.logMessage('Correct value')

Regards,

Laurent Dollé
---
DEV-GCO-GCC-AMD-JAP
+33 (0)4 97 15 34 24

Claudia M <spamknoedelkoenig@?.de>
 To cc bcc Subject [qftestJUI] Calculate with data from the database in a server script

Claudia M <spamknoedelkoenig@?.de>

Sent by: qftestjui-list-bounces@?.de
09/11/2006 10:32

Hi All !

I have two questions, which may be very simple.

With the command "fetchall()" I get two rows from a database which looks like the following:

[(1.0, 0.0), (2.5, 100.0)]
Question 1: How can I seperate these values and save each one in a variable like x, y, z, w ?

Question 2: The values are saved as a string. I need to do some calculation in order to compare the result with a value in the GUI. I need to do this:

if ((x*y + z*w) != 250.0)
rc.logError("uncorrect value !")

How can I convert the strings to double or float ?

Thanks for help !

Regards, Claudia

NEU: Fragen stellen - Wissen, Meinungen und Erfahrungen teilen. Jetzt auf Yahoo! Clever._______________________________________________
qftestJUI-list mailing list
qftestJUI-list@?.de
http://www.qfs.de/mailman/listinfo/qftestjui-list

• References: