More Grafted fields [SOLVED]

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

More Grafted fields [SOLVED]

Postby cantlep » Tue May 25, 2010 9:08 am

Hiya,

I thought I'd got my head round this but clearly not.

In a table called "ContractData" I have some fields that will be populated. What I'd like to do is get some of those fields (there are about 5 in total) to also show up in another table called "BillData".

So, (just testing one of the fields here) in BillData/BillData.php, I did this.
Code: Select all
function __sql__(){
        return "select f.*, f.WinningSupplierStandingChargeType AS WinningSupplierStandingChargeType FROM ContractData f";
}


Here I thought I was basically saying grab me the WinningSupplier..... column from ContractData and call it the same thing in BillData.

It errors in the apache logs saying it's a duplicate column. So I guess it's trying to put in into ContractData again instead of BillData. That command works from the CLI though.

Can you help please?

Thanks

Paul
Last edited by cantlep on Tue May 25, 2010 9:59 am, edited 1 time in total.
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am

Re: More Grafted fields

Postby shannah » Tue May 25, 2010 9:33 am

The __sql__ method ( or the __sql__ directive in the fields.ini file) is meant to provide an alternative "select" statement for loading the records of the given table. It should include a superset of the columns and an equivalent set of rows.

For some more details, please see:
http://xataface.com/wiki/sql_delegate_method

Also check out this excerpt from the unfinished and unreleased Xataface manual that pertains to the __sql__ directive. Hopefully it helps a bit.
http://dev.weblite.ca/xataface-manual-pp.113-116.pdf
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: More Grafted fields

Postby cantlep » Tue May 25, 2010 9:58 am

Thanks Steve,

I was being a tool anyway..I had no common denominator between the 2 tables..so how would it know which column data to use! D'OH.

I'll have a look through the docs you sent.

Cheers

Paul
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 35 guests

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