Hi there,
Glad to say I'm back on my Dataface project after a 6-month hiatus.
My first question of the year:
Is it possible to populate a dynamic valuelist using a SQL query that which includes a variable, that variable being a field in the current record's parent record?
The example:
The valuelist query is currently like so:
__sql__ = "SELECT Course_Code FROM CourseEvent ORDER BY Course_Code"
But I only want the drop-down to offer courses in which the student is currently enrolled, using a query like such:
__sql__ = "SELECT CourseEvent.Course_Code FROM CourseEvent WHERE CourseEventID IN (SELECT CourseEventID FROM Course_Attendees WHERE MasterID='$MasterID')"
So $masterid is the variable in question.
One approach I've considered, perhaps not the most elegant:
I found the elseif clause in table.php which handles the valuelist queries. Within this routine, I could do a substring replacement on $value of $MasterID with the value of the masterid for the parent record. The funny problem I'm having here is how do I simply retrieve the parent record? Or for that matter, the current record? The API documentation as it stands now only describes how to retrieve the related records, so I'm at a loss.
Hope that was clear.
Many thanks,
Shiraz