Jump to content

how to decode/convert the date in visualize.js?


bhavya.k

Recommended Posts

Version: 7.5.0

While passing a parameter to drill-down report from the main report I am getting the from date and the to date in the below format

From_Date: Array [ "rO0ABXNyAA1qYXZhLnNxbC5EYXRlFPpGaD81ZpcCAAB4cgAOamF2YS51dGlsLkRhdGVoaoEBS1l0nGQMAAHhwdwgAAAF1j194QHg=" ]To_Date: Array [ "rO0ABXNyAA1qYXZhLnNxbC5EYXRlFPpGaD81ZpcCAAB4cgAOamF2YS51dGlsLkRhdGVoaoEBS1l0nGQMAAHhwdwgAAAF2Kd5AQHg=" ][/code]

How to decode or convert the above format to Date?

when passed the above parameter to the drill-down report getting the below error

screenshot_from_2020-12-04_18-50-55.png.2453eea36a45d71e493f5d00bbb0fd9d.png

 

{    "value": "failed",    "errorDescriptor": {        "message": "Input controls validation failure",        "errorCode": "input.controls.validation.error",        "parameters": ["ValidationErrorImpl{errorCode='fillParameters.error.invalidValueForType', arguments=[Date], properties=null, defaultMessage='Specify a valid value for type Date.', field='null'}", "ValidationErrorImpl{errorCode='fillParameters.error.invalidValueForType', arguments=[Date], properties=null, defaultMessage='Specify a valid value for type Date.', field='null'}"]    }}[/code]

 

my visualize.js script is as below

visualize({            auth: {                name: "superuser",                password: "superuser",                organization: "organizations"            }        }, function(v) {            v("#main").report({                resource: "/organizations/organization_1/...",                linkOptions: {                    beforeRender: function(linkToElemPairs) {                        linkToElemPairs.forEach(showCursor);                    },                    events: {                        "click": function(ev, link) {                            if (link.type == "ReportExecution") {                                var params = {};                                for (var key in link.parameters) {                                    if (key !== "_report") {                                        params[key] = Object.prototype.toString.call(link.parameters[key]) !== "[object Array]" ? [link.parameters[key]] :                                            link.parameters[key];                                    }                                }                                console.log(params);                                v("#drill-down").report({                                    resource: "/organizations/organization_1" + link.parameters._report,                                    params: params                                });                            }                        }                    }                },                error: function(err) {                    alert(err.message);                }            });            function showCursor(pair) {                var el = pair.element;                if (typeof(el) != "undefined") {                    el.style.cursor = "pointer";                }            }        });[/code]

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...