V4WS 1.11 problem relating 4 tables to calculate SUM of a BO Method

Steven Ronald stevenrt39 at yahoo.com.au
Sat Apr 26 06:24:40 CDT 2008


Ruslan,

I have tables C, B, S and R that are all part of the
same database and related in the following way:

C contains field c1

B contains three fields: C_Ptr, y, S_Ptr:
C_Ptr is an ObjectPtr field that contains the RecID of
a record in C
y is Double
S_Ptr is an ObjectPtr field that contains the RecID of
a record in S

S contains a field sacc

R contains three fields S_Ptr, r, sigma and a BO
Method gaussian:
S_Ptr is an ObjectPtr field that contains the RecID of
a record in S
r and sigma are Double
gaussian is defined using the syntax valMakeNewField(
boRef, "gaussian", "Double", 0, 0,
"exp(-0.5*square((r-1)/sigma))/sigma" );




I try to do this:

cursorRef=valSQLSelect( dbRef, "SELECT bar FROM C
WHERE c1='" & c1 & "'", 2, 3, 2);

cursorRef2=valSQLSelect( dbRef, "SELECT SUM(gaussian)
FROM C,B,S,R WHERE (c1='" & c1 & "' AND B.y<0 AND S.
sacc >0)", 1, 1, 2); 
foo=valGetField( cursorRef2, 1 );
valRemoveCursor( cursorRef2 );

valSetField( cursorRef, 1, foo );
valUpdateRecord( cursorRef);

I get the correct answer for foo but cursorRef is not
updated. When I comment out the three lines in the
middle and add the simple line foo=1 then cursorRef is
successfully updated (bar becomes 1), so the problem
has to do with cursorRef2, it seems to be corrupting
the database or V4WS in some fashion.

What am I doing wrong?

Best Regards,
Steven




      Get the name you always wanted with the new y7mail email address.
www.yahoo7.com.au/y7mail




More information about the Valentina mailing list