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

0

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 [ "rO0ABXNyAA1qYXZhLnNxbC5EYXRlFPpGaD81ZpcCAAB4cgAOamF2YS51dGlsLkRhdGVoaoEBS1l0\nGQMAAHhwdwgAAAF1j194QHg=" ]
To_Date: Array [ "rO0ABXNyAA1qYXZhLnNxbC5EYXRlFPpGaD81ZpcCAAB4cgAOamF2YS51dGlsLkRhdGVoaoEBS1l0\nGQMAAHhwdwgAAAF2Kd5AQHg=" ]

How to decode or convert the above format to Date?

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

{
    "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'}"]
    }
}

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";
                }
            }
        });

bhavya.k's picture
Joined: Dec 3 2020 - 5:23am
Last seen: 10 months 2 weeks ago

0 Answers:

No answers yet
Feedback