Original Message:
Sent: Wed April 19, 2023 09:54 AM
From: Raman Singh
Subject: Set Custom Default value for Date Prompt
Hi Patrick,
I tried but it did not work. Can you please review the below:
First of all here is the version (IBM Cognos Analytics 11.0.13.1 (LTS)) I am working on, as per the link I believe this functionality is available 11.2 onwards.
If the version thing is fine, here is the script and path I used.
Module Path - ../v1/ext/DatePromptPresets/DatePromptPresets1
UI Type - UI without event propgation
Script for DatePromptPresets1.js-
define(function () {
"use strict";
var oPage;
function setDatePrompt() {
};
function setDatePrompt() {
// Create a prompt object using the prompt name set in Report Studio
oPage = oControlHost.page;
var datePrompt = oPage.getControlByName("DatePrompt");
// Set the prompt values using the JSON encoded dates
datePrompt.clearValues();
datePrompt.setValues('2022-01-01');
};
I have tried around playing with JS but no matter what code I try it does not seem to be working. For starters I am just trying to set it to a constant date of '2022-01-01' just to try and make it work.
Thanks,
Raman
------------------------------
Raman Singh
Original Message:
Sent: Tue April 11, 2023 11:36 AM
From: Patrick Neveu
Subject: Set Custom Default value for Date Prompt
Hi Raman,
I assume the easiest way is to use JavaScript.
You can use an extension to load the .js file (for instance DatePromptPresets.zip located in <install_location>\analytics\samples\extensions\Extensions for Custom Controls)
or
You can use a custom control that will reference your javascript file (for instance, /bi/samples/js/DatePromptPresets/DatePromptPresets.js)
There is one report (from the Samples) you might want to test, it is called: "Date prompt presets"
You might test from this URL:
IBM Accelerator Catalog
Best regards,
------------------------------
Patrick Neveu
Positive Thinking Company
IBM Champion
Original Message:
Sent: Thu April 06, 2023 01:15 PM
From: Raman Singh
Subject: Set Custom Default value for Date Prompt
Hi,
My business requirement is to set default value for two date prompts. For example Jan 1st of the current year (Jan 1, 2023) and last date of previous month (March 31, 2023).
I am wondering if this is possible without writing a java script.
If java script is the only route to accomplish this, does java script have to be written and hosted on the server and then javascript file referenced using Custom Control or can I just write a local java script in HTML item?
Thanks.
------------------------------
Raman Singh
------------------------------