I have created 20 forms complete with graphics, radio buttons, and text boxes to represent 20 questions asked. I created a table of examiners just to get a value list from this data. also likewise with students. I placed a tab panel on my main form with the 20 questions and a global examiner and a global student (at the top not in the tab panel). the value lists are working and populate the two globals with names. I wanted a relationship to show only the current examiner/student selected in the tab panel, thus allowing movement from question to question simply by clicking a tab. then I got in trouble. I can’t seem to create a relationship to base the tab panel on?
I tried creating a global called examiner_student and populating it with a button press. That worked but I can’t reference it in the relationship creation dialog.
I tried creating a calculation that returns examiner + student. Still can’t see it in the relationship creation dialog.
I would like to know the best way to filter the data in the tab panel to show the current examiner/student! Ideally, the examiner can switch between students and answers easily.
…
I could never get the relationship built that I needed for this to work. I ended up doing a currentcontroller.find() on the concatenated field examiner/student and this works well enough for now. I learned how to create calculated fields and store them by using the same name as the column name in the database… very cool.
I tried several relations…
examiner fullname + student fullname exists in each question (hidden).
I was thinking that I could place global examiner and global student on the main form and create a relationship from the calculation of global examiner + global student in the main form to examiner + student in the questions table.
I was used to creating relationships at will in filemaker and using portals everywhere I needed them. Maybe I will try again later. I could be doing something wrong when I create the calculated field.
do you mean use the primary key in place of the name field?
I am trying to filter on global value. Is that wrong to do? Maybe I should rethink this. I ALWAYS have a primary key in servoy, so i could return the primary key from the value list? is that what you mean? I am looping thru testing for empty or null before I do a search/find. I have it working. It does seem to be harder than with filemaker to get this right. It may be something I just need to get used to. I will try this and see what happens…
Filtering lists with relationships is a very Filemaker approach
Be that as it may, it works the same in Servoy as it does in Filemaker:
• Your two global filters should ideally have value lists that show a text value (say a name) but store a key value.
• Your questions table should have id_examiner and id_student columns
• Create a relationship with both globals on the left matching to the respective id_examiner and id_student columns on the right.
• Create a list or table view based on the questions table. Place this in a tab panel via the relationship on a form.
We don’t use relationships anymore for this type of stuff. We would use the same GUI setup (with global filters) and use the onDataChange() event on the globals to fire a method that finds the exact records. In this scenario, the only form setup difference is to show the questions list as an unrelated form in the tab panel. You optionally can also fire any default filtering methods on the form onLoad() and/or onShow() events.
This keeps GUI logic and data structure logic nicely separated into methods and relationships. It also avoids unwieldily relationships (say you want to filter on 15 columns…) and relationship lists that go on forever (alla Filemaker relationship hell).