V4WS 1.11 - what is syntax for querying related tables?
Steven Ronald
stevenrt39 at yahoo.com.au
Wed Aug 15 05:58:03 CDT 2007
Ruslan,
I haven't had to query related tables until now, and I
can't figure out the correct executable syntax for
doing so from the documentation.
I have a table:
dbRef_usdb=valMakeNewDatabase("usdb");
boRef_foo=valMakeNewBaseObject( dbRef_usdb, "foo" );
fldRef=valMakeNewField( boRef_foo, "uscoo", "ULLong");
valSetFlagOfField( fldRef, 1, true );
valSetFlagOfField( fldRef, 2, true );
valMakeNewField( boRef_foo, "S", "ULong");
valMakeNewField( boRef_foo, "comm", "Double");
valMakeNewField( boRef_foo, "timestamp", "datetime");
valMakeNewField( boRef_foo, "triggerflag", "Boolean");
I then add a number of records to it, two of which
have triggerflag=1 (the rest have triggerflag=0)
I make another table in the same database:
boRef_trigger=valMakeNewBaseObject( dbRef_usdb,
"trigger" );
fldRef=valMakeNewField( boRef_trigger, "us_Ptr",
"ObjectPtr");
valMakeNewField( boRef_trigger, "payment_owed",
"Double");
and then i add two records to this table, using the
RecID of each record in foo with triggerflag=1 for the
value of us_Ptr of each record.
Question 1): is this the correct way to set up two
tables that are related if you want to query them?
Question 2): when i open usdb using the Valentina
Carbon 1.10 application, i see two entries in the pull
down list next to Object: - foo and trigger. If I
select foo then click the U button, I can view the
table, seeing all the entries. However if I select
trigger and click the U button it shows me the foo
table again, and I can't ever see the trigger table -
why?
Question 3): I want to query these two tables so i can
find the value of payment_owed for all records in foo
that have triggerflag=1. The syntax I tried is
dbRef_usdb=valOpenDatabase("usdb");
cursorRef_trigger=valSQLSelect( dbRef_usdb, "SELECT
payment_owed FROM trigger,us WHERE triggerflag=1 AND
us.RecID=trigger.us_Ptr");
but I get the runtime error "wrong expression" for
this line when i try to run it. I've also tried every
permutation of this syntax I can think of without
success.
What is the correct syntax?
Best Regards,
Steven
____________________________________________________________________________________
Sick of deleting your inbox? Yahoo!7 Mail has free unlimited storage.
http://au.docs.yahoo.com/mail/unlimitedstorage.html
More information about the Valentina
mailing list