Jump to content

Faster method to get the last related record?


rivet

This topic is 3102 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have two tables:
- todo
- response

I have a list view layout: todo_list

On the layout there is a single text area with the following merge tags:

<todo::dueDate> <todo::detail> <todo::lastResponse>

 

the field:  lastResponse, is a calc field in the todo table

If ( Count ( response::id ) > 0 ; 

   GetValue ( response::user    ; 1 ) & "| "&
   GetValue ( response::comment ; 1 ) 
 
"" )

 

The relationship to the response table, is sorted by ID descending. That way I get the most recent response to the top of the list for the calc above.

 

While the performance is okay, I am wondering if there is something I could do to make the list display faster/smoother since it is a bit choppy.

 

 

 

 

speedPlease.mp4

Edited by rivet
Link to comment
Share on other sites

Since the relationship is sorted, you could just display the two related fields directly, without using a calculation. You could then use the "Hide object when" feature with a calc of IsEmpty(response:id).

Note that hiding the object is only necessary here to hide the vertical pipe. You could try it without that and see if it helps performance. I would expect that using IsEmpty() should give you slightly better performance than Count().

You could also try using a non-sorted relationship, and getting the related fields using the Last function, keeping in mind that if one of the fields can be blank, you might get mis-aligned results. To get around that, you could calculate the concatenation in the response table, and then get the Last of the calculated field.

Link to comment
Share on other sites

Thanks Fitch, that got me in the right direction.   In the end I just merged the fields from the related table directly onto the parent layout.  The merge takes the first record from my sorted relationship and I am just going to live with the empty pipes.

Link to comment
Share on other sites

This topic is 3102 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.