Related records query

A place for users and developers of the Xataface to discuss and receive support.

Related records query

Postby barryrs » Tue Aug 16, 2011 12:49 pm

Steve,

Thanks again for a great product! I really enjoy seeing a db front end come together so easily!!
Thought you might enjoy this :)

Had trouble pulling related records with additional criteria (ie. relationships cannot use OR, etc.)
My solution? Tell it what I don't want, it'll give me the rest :)
(All I wanted was types 3 or 4)

__sql__ = "SELECT * FROM `transaction` WHERE AccountID= '$AccountID' and TransactionTypeID != 1 and TransactionTypeID != 2 and TransactionTypeID != 5 and TransactionTypeID != 6 and TransactionTypeID != 7"

Thanks again,
-Barry
barryrs
 
Posts: 14
Joined: Tue Feb 15, 2011 11:37 am

Re: Related records query

Postby ADobkin » Tue Aug 16, 2011 2:35 pm

I wasn't aware of the 'OR' restriction in relationships.ini, but would this work?

__sql__ = "SELECT * FROM `transaction` WHERE AccountID= '$AccountID' AND (TransactionTypeID = 3 OR TransactionTypeID = 4)"

Just a bit shorter and more to the point, but your solution is a good workaround if 'OR' is completely unsupported.

Alan
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: Related records query

Postby barryrs » Fri Aug 19, 2011 6:20 am

That was my original code! But alas, it didn't work, that's how I eventually discovered the restriction (in the wiki).
Steve mentioned (wrote) he may revisit a solution to the 'OR' issue at some later date.

Cheers, Baer
barryrs
 
Posts: 14
Joined: Tue Feb 15, 2011 11:37 am

Re: Related records query

Postby shannah » Mon Aug 22, 2011 2:00 pm

In either of these cases I think it will give the parser problems at some point. The OR restriction on relationships is because if there is an OR clause then Xataface doesn't know exactly how to insert new records into the relationship. Same thing happens with a != comparison.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 27 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved