If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Custom control to validate 2 prompt dates

Started by rteruyas, 01 Feb 2018 09:15:00 AM

Previous topic - Next topic

rteruyas

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!

Happy Reporting!
[Ray]

rteruyas

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');
Happy Reporting!
[Ray]