I have a referenced table question. I have ...

(Nathan Stufflebean) #1

I have a referenced table question.

I have an app that has lead information in it. I have another table that has tasks that reference the organization in the leads table. The tasks are timestamped, but the task table contains multiple tasks for each organization.

What I want to do is add a column to the leads table that contains the most recent task timestamp from the tasks table. This is so I can have this as a column for sorting in my leads table view.

I’ve tried several things and can’t quite figure out the best way to do this. Does anyone have advice?

(Tony Fader) #2

@Nathan_Stufflebean Here are a couple of examples that should help.

Most recent row (single table): appsheet.com - Most Recent Value - Initialize forms with most recent value

Most recent child row (with table refs): https://www.appsheet.com/samples/This-app-shows-how-to-get-the-most-recent-related-row-for-a-table?appGuidString=62bcb547-8e35-4f69-a194-4494642b4760 Most Recent Value - Initialize forms with most recent value appsheet.com

(Nathan Stufflebean) #3

Thank you so much! I’m going to try this and see if I can get it to work within my app.

(Nathan Stufflebean) #4

What if I want it to display the most recent timestamp instead of the child name?

(Tony Fader) #5

@Nathan_Stufflebean Follow the recipe in those apps. You should end up with a virtual column referencing the most recent row. Make that virtual column hidden, then create a new virtual column with a dereference formula like [Most Recent Row].[Your Timestamp Column].

help.appsheet.com - Dereferences Dereferences help.appsheet.com

(Nathan Stufflebean) #6

I’m not getting any errors, but it also doesn’t seem to be working.

(Tony Fader) #7

@Nathan_Stufflebean Can you give more information about how it’s not working? Here’s info about how you can troubleshoot app formulas: help.appsheet.com - Expression Assistant and Expression Builder Expression Assistant and Expression Builder help.appsheet.com

(Nathan Stufflebean) #8

All expressions work and it does grab the latest task. However, it’s not automatic. If a new task is created it doesn’t update the field unless the lead record is resaved. Then it will recalculate. I need it to always display the most recent task timestamp.

(Tony Fader) #9

@Nathan_Stufflebean Are you putting the formula in a virtual column, or a non-virtual column? help.appsheet.com - Virtual Columns

Virtual columns are recomputed automatically. Non-virtual columns with app formulas will only be recomputed when they’re edited. Virtual Columns help.appsheet.com

(Nathan Stufflebean) #10

Ah, I assume that is my problem. Let me


(Nathan Stufflebean) #11

Awesome! I think I have it working now. Well, you have it working. Thanks!!