cancel
Showing results for 
Search instead for 
Did you mean: 

Lumira Locale Issue

0 Kudos

Hello All,

Requirement: User want to pass date to Webi report and they want to have it set on the date field so that they can directly run specific reports accordingly.

Case:

Report 1: (Reference Date) Date field should be set as today's date: screenshot attached 1

Report : From : Today's Date and To: +5 years date filed.screenshot attached 2

URL to open Webi Report: http://localhost:53004/BOE/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=Fi8qDQDPcw4AFy4...Date=12/17/2019

var part_forecast_from = APPLICATION.getInfo().dateNowInternalFormat;
var year = Convert.stringToInt(part_forecast_from.substring(0,4));
var year_to = Convert.stringToInt(part_forecast_from.substring(0,4)) + 5;
var month = Convert.stringToInt(part_forecast_from.substring(4,6));
var day = Convert.stringToInt(part_forecast_from.substring(6,8)); 

We coded that part and set the date by changing the date format 20191201 to 1 dec 2019 in date field, then change that date to mm/dd/yyyy so that it get passed to Webi report.

var dayStr = day + ""; 
var monthStr = month + "";
if (dayStr.length == 1) { dayStr = "0" + dayStr; }
if(monthStr.length == 1) { monthStr = "0" + monthStr; } 
var date_from = year + monthStr + dayStr; 
var date_to = year_to + monthStr + dayStr; 
FROM_DATEFIELD.setDate(date_from); 
TO_DATEFIELD.setDate(date_to); 
REFERENCE_CAL.setDate(date_from); 
part_forecast_from = FROM_DATEFIELD.getDate(); 
var part_forecast_to = TO_DATEFIELD.getDate();
var reference_date = REFERENCE_CAL.getDate();

Issue: As we set the date and get the date in hard-coded text i.e. dd/mm/yyyy format which can only be passed the value to English locale users and now some users are from different locale like German, if we set the date in string it is not getting changed to defined locale setting for different users.

TEXT_6.setText(reference_date.substring(4,6) + "/" + reference_date.substring(6,8) + "/" + reference_date.substring(0,4));

Also If I change the dateNowInternalFormat to DateNow(Values cannot be set on the datefield as we cannot change all the locale to specific string and set it on the date field).

Is there any way possible to change the code or any setting to solve this issue.


Code: var part_forecast_from = APPLICATION.getInfo().dateNowInternalFormat;
var year = Convert.stringToInt(part_forecast_from.substring(0,4));
var year_to = Convert.stringToInt(part_forecast_from.substring(0,4)) + 5;
var month = Convert.stringToInt(part_forecast_from.substring(4,6));
var day = Convert.stringToInt(part_forecast_from.substring(6,8)); 
if(day <= 0) { month = month - 1; 
if (month == 0) { year = year - 1; month = 12; } 
day = day + days[month] + leapYearOffset; } 
var dayStr = day + ""; 
var monthStr = month + "";
if (dayStr.length == 1) { dayStr = "0" + dayStr; }
if(monthStr.length == 1) { monthStr = "0" + monthStr; } 
var date_from = year + monthStr + dayStr; 
var date_to = year_to + monthStr + dayStr; 
FROM_DATEFIELD.setDate(date_from); 
TO_DATEFIELD.setDate(date_to); 
REFERENCE_CAL.setDate(date_from); 
part_forecast_from = FROM_DATEFIELD.getDate(); 
var part_forecast_to = TO_DATEFIELD.getDate();
var reference_date = REFERENCE_CAL.getDate();
TEXT_3.setText(part_forecast_from.substring(4,6) + "/" + part_forecast_from.substring(6,8) + "/" +part_forecast_from.substring(0,4));
TEXT_4.setText(part_forecast_to.substring(4,6) + "/" + part_forecast_to.substring(6,8) + "/" + part_forecast_to.substring(0,4)); TEXT_6.setText(reference_date.substring(4,6) + "/" + reference_date.substring(6,8) + "/" + reference_date.substring(0,4));

Accepted Solutions (0)

Answers (1)

Answers (1)

reiner_hille-doering
Active Contributor
0 Kudos

I don't know enough about WebBi, but maybe it helps that newer versions of Lumira Designer also contain the JavaScript "Date" object which is good for many kinds of time/date manipulation and converting operations.