by shannah » Mon Jan 19, 2009 12:17 pm
%field%__pullValue() is more for preparing a value for use in a form. If these values are coming from outside the MySQL database perhaps it is better to define a calculated field.
i.e.
field__%myfieldname%() for these items. The up side of this is that programatically you'll be able to use the field as if it was any other field. The down side is that these fields won't show up by default in the view tab or the edit tab, unless you explicitly implement a block displaying the field.
Another option is to define a dummy grafted field in the __sql__ directive of the fields.ini file, then use %fieldname%__display() to override how this field is displayed (i.e. get the data from the actual source). The up-side of this option is that it will display in your list and view tabs by default. The down side (as with the previous approach) is that you'll be making a database call to your external data source for each field and record... this could result in a lot of database calls per request).
Another approach is to actually import the entire result set of relevant data into a mysql table, and periodically refresh it. Then you can just use the __sql__ directive in the fields.ini file to graft the appropriate fields onto the end of your table. A clever implementation of this strategy would probably give you the best results, as then you would be able to search on these fields as well.
-Steve