sql and visibility:list=hidden
Archived from the Xataface Users forum.
rugcutter — Thu Apr 23, 2009 9:46 pm
Hi Steve -
1st off Xataface is great stuff. Kudos to you and all your hard work.
I’m using version 1.1.5. My fields.ini has __sql__ in it. The odd thing I am seeing is that visibility:list=hidden is not being handled for all of the columns that are defined in __sql__.
Here is a section in my fields.ini :
- Code: Select all
- `sql = “select cp_id,
cc_sort_order,
cp_category_id,
cp_notes,
cp_short_description,
cp_target_date,
cp_focus,
cp_create_date,
cp_update_date
from cas_priorities cp
left join cas_categories cc
on cp_category_id = cc_id”[cc_sort_order]
visibility:list=hidden[cp_id]
visibility:list=hidden`
What I am seeing is that cc_sort_order is hidden in the list view, but cp_id is not. The pattern I am seeing is that if I set visibility:hidden for columns that are selected from the main table (cas_priorities), they still show up however for the joined table (cas_categories) the columns are hidden - as expected.
This does not happen when I do not include __sql__ in my fields.ini. The fields set visibility:list=hidden work as expected.
I put in a cheesy workaround where I wrapped the SQL in a subselect like this:
- Code: Select all
__sql__ = "select * from ( select cp_id, cc_sort_order, cp_category_id, cp_notes, cp_short_description, cp_target_date, cp_focus, cp_create_date, cp_update_date from cas_priorities cp left join cas_categories cc on cp_category_id = cc_id ) results"
With my workaround the fields set visibility:list=hidden work as expected.
Any ideas?
shannah — Mon Apr 27, 2009 6:46 pm
One thing that it could be is that Xataface expects your __sql__ line to select ALL columns from the base table, and append additional columns as necessary. Haven’t had a chance to dig into the code, but this could be what is tripping it up.
e.g.
__sql__ = “select cp.*, cc.cc_sort_order from cas_priorities cp left join cas_categories cc”