I have three tables: species (PK = species_id), museums (PK = museum_id), and a correlation table (spec_mus) of species and museums with some additional information (PK = species_id + museum_id).
I want to show a sortable, searchable, editable list of species and additional information for each museum. Currently I have a form based on museums, with a related form based on spec_mus showing in a tab panel. As I want to display the species_name (from species) so the information is meaningful, I include this related field also.
The problem seems to be that this related field is the one I need to sort on. Entering it as a default sort works fine when just this form is displayed by itself, but when it is displayed in the tab panel the related records no longer appear at all… After restarting the application they are there, but still not sorted.
Should I be doing something differently?
(I did try using a portal, but I can’t reach the species_name field directly from the museums_to_spec_mus relation, so I had to add a calculated field, and of course you can’t sort on that…)
I have been unable to reproduce it in a sample this week, though I could before I sent the post. I am an leave for a while now, but will let you know if I’m still having problems when I return. Thanks for your help,
Does that mean that a form in a tab panel can also only be sorted by the relationship it’s loaded by? In my case that is frustrating, as the primary key is an ID number which the user will not know or see: it will make much more sense to the user to display the data sorted by the related field which they do see (ie. Genus name).
I have managed to replicate this problem in a sample solution, which I have attached. Currently there is no sort in place, so the data appears in order of primary key. If you add a sort option to sort by the related field Genus name, none of the data appears on the form when displayed as a tab.
there is a problem with that attachement.
I can’t download it.
Also on what kind of data is it build? the example data or did you include some sample data?
Sorry, something’s clearly gone wrong during the upload: the original file I attached works fine, but I can’t download this one either. I’ll try reposting it. I included sample data with the solution, but have realised that you probably need the database as well to connect to. How do I send this? The database is currently in MySQL. (I’ll post solution and database together.)
THis problem was fixed beautifully in 2.1.2, but now I’m using Version R2 2.2b3-build 318, and it seems to have broken again. You can enter the sort fields from related tables using the property editor as expected, but when you click ‘ok’ only the field names appear in the initialSort field, without the relationship attached. For example, although you select ‘table_A_to_table_B.field1’ in the editor, only ‘field1’ appears. As field1 is not in table_A which the form is based on, the data is not sorted.
Yes, the problem is still there. I have sent you a simple solution with test data to demonstrate (no attachments on forum at the moment). The master record is a locality, and in the tab panel appears a list of species found at that locality. The species list (in the tab panel) should be sorting by order, family, subfamily, etc. - I have entered the sort criteria in the initialSort property.
The problem seems to be that the fields shown on the form are related fields. They are all available to select in the sort dialog, but when you close the dialog instead of appearing as ‘com_species.order’ they lose the table prefix and become just ‘order’. Because ‘order’ doesn’t exist in the table the form is based on, the sort criteria are ignored.
I have several forms in my real solution which I set up while this feature was working, and they still sort perfectly on the related fields. (I haven’t chaged the sort criteria, and it still displays the table prefixes.) The problem now is that the sort dialog won’t save the table prefix, and there is no other way to edit the sort criteria.