Sorting best practice

Hello!

I want to add custom sorting to a list after reading. When using the sort node this resets the sort on DB-connected sources when data changes. If I add a function property it becomes too slow. If I do it in a runtime source I need to read too much data on simple navigation to keep information updated. What is the best practice way to do this in Appfarm?

Example: I wish to sort a source on status and a date field within each state

Hi, thanks for reaching out to the community!
It sounds like you are looking for a custom sort that only applies to one specific UI component, without disrupting how that data is sorted elsewhere in your app. I’m also guessing your status property might currently be sorting alphabetically or in a way that doesn’t match your business logic.

If I’m understanding the challenge correctly, a couple of approaches might work here:

  • A dedicated data source: Instead of reusing a shared data source, it might be easier to create a separate DB-connected data source exclusively for this component. You can add sorting rules (status, then date) directly to it.
  • A sort-weight property: Assuming you’re not already using an integer enum for the status that would handle status sorting natively (10, 20, 30), you could create an integer property on the object class to act as a sort weight. By updating it whenever a record is created or updated, the database will naturally understand your logical business order without needing to calculate it on the fly.

I’ll leave this thread open in case others in the community have input to this topic.

Thank you for great suggestions! I wanted to keep everything in one source to simplify filtering, but I think the solution is to use runtime sources to control reading and then sort