@tim.young is it possible to style it like a standard table?
I’d like to do as many of the following as possible:
Fix the output to days only (no months) and remove “days ago” so the column only contains a number
Turn the text red if > 30 days
Stop counting and retain the final value if a record drop down field is marked “Lost” or “Hold”
If the deal is marked “Won” stop counting and set the final value to the difference between “Application Date” and “Close Date”
I’ll probably need to create a new equation field for this in the data table, but that’s fine. Then I can use that field to solve #1.
For context, this is a deal pipeline and the purpose is to track time on the pipeline. So if there is another solution that will achieve the results, that’s fine too.
Are you looking at simply displaying the values dynamically in a custom component, or doing this on the database level?
For 1 and 2, you can create your own helper (with code). I’ll write up something simple and explain, but it’s quite complex.
For 3 and 4 you might need to address this at the database with custom fields, but you can also just display it in the app. Let me know and we’ll be delighted to help.
The key here is that we are using 3 curly braces since we’re responding with HTML.
I’ll try and explain the code a bit:
At the bottom we have 2 functions. One to get the difference in time between 2 dates we pass it. The second, to cover the date from SQL to Javascript.
We created a custom Helper called “james_custom_2” (call it whatever you wish, but be sure to update the custom component to match.
In this custom helper we pass 3 values, the application date, closing date and status. In the rest of the code we first check is the ‘status’ is equal to Won, if yes, it runs its own code. Otherwise, we find the difference and return the values.
The custom component is truly a powerful component that can achieve nearly anything imaginable when it comes to outputting the data. It might however require some coding. But HandlebarsJS is pretty easy.