Skip to main content
Question

Use variable data as part of a report description for a summary table

  • August 15, 2018
  • 0 replies
  • 86 views

There was a question asked a year ago (https://community.quickbase.com/quickbase/topics/adding-a-report-legend-using-report-description) regarding creating legends using html for a table report. Dan Diebolt was able to use IOL to get the legend presented. 

So heres the ask:

I have a rolling 90 day report and Im being asked to have a time line published as part of the report description. Any ways, I wanted to use 2 variables (1 which would generate todays date and another to generate [Today()-Days(90)] date) which could be pushed into the report description of a summary table.

  • Registered
  • August 19, 2018
Use this code:
require(['moment'], function(moment) {
  var fromDate = moment().subtract(3, 'months').format('MM/DD/YYYY');
  var toDate = moment().format('MM/DD/YYYY');
  $("#introText td").html('From ${fromDate} to ${toDate}');
});

You can test this code from the console. Here is a screenshot with some dummy text set as the description and before the code is executed.



Here is a screenshot after the code is executed:



Notes:

1) This code uses QuickBase's chosen loader library requirejs to load the moment library which is already configured (because QuickBase uses itself uses it on various pages).

2) If you have any need to manipulate dates within your script solutions you should use the moment library as it support every conceivable date manipulation under the sun

MomentJS Library
https://momentjs.com/

If you need further assistance feel free to contact me off-world using the information in my profile:

https://getsatisfaction.com/people/dandiebolt