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

Steven Ronald stevenrt39 at yahoo.com.au
Sat Apr 26 21:53:51 CDT 2008


Ruslan,

if I replace SUM(gaussian) with gaussian and then loop
through the cursor to sum the individual values it
solves the problem.

So, this doesn't work:

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); //record is not updated!


This does work:

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

cursorRef2=valSQLSelect( dbRef, "SELECT gaussian
FROM C,B,S,R WHERE (c1='" & c1 & "' AND B.y<0 AND S.
sacc >0)", 1, 1, 2);
n=valGetRecordCount(cursorRef2);
foo=0;
repeat with cursorindex from 1 to n
    valGoToRecord( cursorRef2, cursorindex );
    foo = foo +valGetField( cursorRef2, 1 );
end repeat;
valRemoveCursor( cursorRef2 );

valSetField( cursorRef, 1, foo );
valUpdateRecord( cursorRef); //record is updated!

I can use the second solution so its not a critical
issue for me, its just less efficient.

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