List methods
RISE provides a method sterotype called List for listing instance of an entity or view. It should be noted that an entity may have many different List methods based on different filtering criteria or sort order, each returning different subsets of the attributes available in the entity or view. This article discusses specifying filter criteria and sort order, see
User managed methods for more details on methods with custom return sets. Furthermore, a list method can be specified to use extended query mode where the final filtering criteria and sort order are computed in run-time, see
Extended queries for more details on this topic.
When implementing an entity in an interface the following List methods are automatically created:
-
One List method, named List<entity name>, for listing all instances of the entity
-
One List method for each foreign key, named List<entity name>By<foreign key>, for listing all instances related to an instance of another entity
When implementing a view in an interface a single List method name List<view name> is automatically created.
Rules for the List method sterotype:
By default - for automatically generated List methods - the return set contains:
-
The ID of the instance itself
-
All attributes defined by the entity or view
-
All foreign keys implemented by the entity or used by joins in the view
The IDocument example
We examplify a List method with the method ListDocument, ListDocumentByFolder and ListFolderByParent methods in the interface IDocument in the model below.
This will result in the following ListDocument method viewed using the RISE method editor. Note that the method has no arguments and returns all documents. For many objects this is quite useless and it might be a good idea to provide the method with input arguments for filtering. This is done by dragging arguments from the "Custom fields" node in the left-hand tree and dropping them on the arguments node in right-hand tree. Arguments and return set members may then be dragged into the "Filter by" text field to form the needed filtering criteria.
The method ListDocumentByFolder is automatically generated since the Document entity has a foreign key referencing the Folder entity. In this case, RISE has suggested arguments and filtering criteria matching the purpose of the method (document folder reference should equal the input argument). If needed, provide the method with a sort order by dragging return set members into the "Order by" text field.
Finally, since the Folder entity has self-reference named Parent, RISE generates a ListFolderByParent method. This method is automatically provided with an argument named ParentID and a criteria requiring the returned instances to have a Parent foreign key matching the argument. Thus, this method will return all Folder that are children of the folder identified by the argument.