Order SubViews by Multiple Related Fields

Hi there,

Loan preparation forms at CAY herbarium (context)

I’m working on designing handy loan forms for CAY staff. On the loan form :

  • They need to see at a glance all the loan preparations with loan date, loan preparation returned date, collectors, collector number and preparation bar code.
  • They also need and expanded view for each loan preparation with additional information : shipment number, taxon, receiver.

These specifications were perfectly addressed with the help Edit the Form Grid to Display Different Fields Than the Subform. I created two views

  1. LoanItems Grid View
  2. LoanItems Form View

It worked like a charm! :tada:

Sorting loan preparations

Multiple sort fields

For some loans we may have dozens or even hundreds of loan preparations, so my colleagues asked for sorting default grid view by Collectors, and Collector number.

Since Specify 7.7 I read that subviews accept one sort field argument sortField=${fieldName}.

So at CAY we +1 #1266 for multiple sort fields.

Sort by related fields

Our LoanItems subview only contains one field from the Loan Preparation table and every other displayed fields are related fields:

  • loanReturnPreparations (aggregated)
  • preparation.collectionObject.collectingevent.collectors (aggregated)
  • preparation.collectionObject.collectingevent.stationFieldNumber
  • preparation.BarCode

Subview definition then looks like:

<cell type="subview" viewname="LoanItems_Aublet3_Form" id="10" name="loanPreparations" defaulttype="table" initialize="sortField=preparation.collectionObject.collectingevent.collectors" colspan="17" rows="4"/>

Sorting is not working, no matter which related fields I’m using.

:question: does sorting subviews work with related fields / aggregated related fields ?

Wish list

This is how I’d like to initialize the subview:

<cell type="subview" viewname="LoanItems_Aublet3_Form" id="10" name="loanPreparations" defaulttype="table" initialize="sortField=preparation.collectionObject.collectingevent.collectors,preparation.collectionObject.collectingevent.stationFieldNumber" colspan="17" rows="4"/>

Thanks !