Hi All, Is there any way to limit the number of record in the list vi

Hi All,

Is there any way to limit the number of record in the list view of an entity backed records. For eg: I created a entity backed employee record I want to show only latest five records to the user in the list view. Is there any way to configure it

OriginalPostID-169273

OriginalPostID-169273

  Discussion posts and replies are publicly visible

  • I am not aware of any OOB solution to this problem as I do not think there is a way to limit the number of records that are returned from the Record Type designer. However, you could accomplish this on the back end by creating a view in your database that takes your employee table and orders it by most recently updated, and then only returns 5 rows. If you back your record with this database view instead of the table, you should only see up to 5 records in your list view at any given time.
  • You can use service-backed records for this use case. In the source expression you can configuring paging info of query rule to get last 5 rows based on some logic.

    Please see the documentation link of the same.

    forum.appian.com/.../Records_Tutorial.html
  • @sunnya If your requirement is to just show 5 latest records all the time, then you could effectively make use of the default filter on the record type as per my knowledge instead of building new objects just to satisfy this requirement.
  • I had considered the default filter as a possibility, but I was not able to think of a way to use it to meet this requirement. To filter out all records except for the 5 most recently updated, you would have to know the date and time of the 5th most recently updated record; then you could set a default filter to remove everything before this date and time. However, I was not able to think of a good way to accomplish this. If there is one, however, I would be interested in learning what it is.
  • @patrickh Let's say we do have a rule by name 'getLatestMyEntityRecordIdsToIncludeInListView' and its definition will be as follows:
    a!queryEntity(
    entity: cons!MY_ENTITY,
    query: a!query(
    selection: a!querySelection(
    columns: {
    a!queryColumn(
    field: "id"
    )
    }
    ),
    filter: null,
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 5,
    \t sort: a!sortInfo(
    field: "lastUpdated",
    ascending: false
    )
    )
    )
    ).data.id

    The objective of the above rule is to fetch only those ids of the records that were last updated and that too only those many records (5 in this example) that were specified in batch size.

    In the default filters of the Record, you could include a condition as follows:

    id IN rule!getLatestMyEntityRecordIdsToIncludeInListView()

    That is just an idea, but we could later extend the getLatestMyEntityRecordIdsToIncludeInListView rule and make it work on any other column(s), any other condition(s) and thereby give the filtered or desired records.