grafted fields

Archived from the Xataface Users forum.

Jean — Thu Sep 15, 2011 5:49 am

Hi Steve,

I have some difficulties to find documentation about the grafted fields.
I added the __sql__ statement at the beginning of my fields.ini. Then I checked up my query to be sure, it is OK.
But the field is not displayed. Did I forget an operation ?

Thank you

Jean


shannah — Thu Sep 15, 2011 11:01 am

Hi Jean,

A couple of things to check for:

  1. If you have set blanket default permissions for your fields using the __field__permissions() method you could be disallowing access to the field.
  2. If you have set default field visibility in the fields.ini file via the [__global__] section….
  3. Check to make sure that your __sql__ directive is at the beginning of the file and that it is __sql__ and not _sql_
  4. Try to enter an obviously invalid SQL query for the __sql__ directive to see if you get an error (to confirm that it is picking up the __sql__ directive at all).

-Steve


Jean — Fri Sep 16, 2011 12:51 am

Thank you Steve.

I checked up all your suggestions. Syntax is right but yes the __sql__ is not taken into account although the statement is at the beginning of the fields.ini.

Code: Select all
__sql__ = "select p.*, d.total from programmation p left join devis d on p.id_proposition_artistique=d.id_proposition_artistique"

Jean — Fri Sep 16, 2011 1:45 am

Well Steve, it works with the function __sql__ in the delegate class. I don’t understand why it did not work in the fields.ini.
Jean


shannah — Fri Sep 16, 2011 9:40 am

This is a long shot, but try putting something else (not a section) before __sql__

e.g.

Code: Select all
foo=bar __sql__="...."