So I spent the evening trying to figure out "smart folders" (see Smart Fields), which I will call Query Equations for the rest of this post.
I'll start on the doc itself, it started as a blog post and I think it's time to update it :). I think we need to rework this page in the context of the equations pages and equations in general. Also, some of it duplicates concepts that are now covered better elsewhere like field/folders, grids, and wikitags, Also, many of the examples I think are better (or at least more easily) done as row equations, so I think we need to be clear why they would go the next level to use these.
In terms of terminology, smart folder/field now overlaps too much with all the other equations. Perhaps we could call these "Query Equations" to just ensure they are grouped with all the other ways that fields can get their values? "Query Fields" seems more correct to me, I like the common term of equation.
I also think that after we pull out the duplicate field/folder/grid stuff, we can then restructure to better focus what is really going on here. There is some important magic going on that needs to be explained better. I'm not sure I understand it so I can't just make the change, but let me guess and perhaps someone (Pierre?) can confirm/correct....
What I *think* is happening is:
Every field is represented internally by a "field view" - a sql view with the name _q<fieldname>. Each of these field views has two key columns - the ItemID and the field value (which has the same name as the field).
A grid source is then essentially a view that consists of all of its field's joined using ItemID. An actual grid is that source combined with a where clause based on its source bar filter and a sort by clause based on its source bar sort.
For normal fields the field view is a query against an underlying table with the actual values.
For query equations/fields we can replace this view with our own "query field view". This "query field view" can query against other field views and grid views any way it wants as long as it creates the two key columns - ItemID and <itemname>. Then it gets joined into a grid just like any normal view field view.
Am I close?
Also, there is a FieldID column used in the URl example that isn't explained. Maybe its something special to do with the URL table?
And do we want people messing with this? I know I want to mess with it, but should others :)?
d
Comments
FROM AdrsBook INNER JOIN ¯qWorkSprint ON cstr(AdrsBook.Item) = cstr(¯qMyContacts.MyContacts)
WHERE AdrsBook.Tel IS NOT NULL