Hey guys, I'm trying to follow this tutorial
http://www.pmsquare.com/main/blog/cognos-analytics-custom-javascript-date-prompts-datasets/
But seems that I'm not able to import the "moment.js" library
The error message I get when running the project is
Error: Module name "moment.js" has not been loaded yet for context: _. Use require([])
Let me know if you need more detail
Thanks in advance!
Nevermind, just figured it out.
I need to make an asynchronous call when using define
----------
define( ["/samples/javascript/moment.js"], function( moment ) {
"use strict";
function FromToDateValidation()
{
};
FromToDateValidation.prototype.initialize = function( oControlHost, fnDoneInitializing )
{
var o = oControlHost.configuration
, NO_VARIABLE_DEFINITION_FOR_MOMENT_HERE
, secondaryRun
, dynStartDate
, dynEndDate
, datastores;
this.ctrlFrom = o ? o["fromPrompt"] : 'fromDate';
this.ctrlTo = o ? o["toPrompt"] : 'toDate';
secondaryRun = sessionStorage.getItem(this.ctrlFrom+'secondaryRun');