Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3189

Re: Populating values for Dropdown using system date

$
0
0

Hi Bala,

 

In that case, the revised code is as follows:

 

var today = APPLICATION.getInfo().dateNowInternalFormat;

 

var month = Convert.stringToInt(today.substring(4,6));

var yearYY = today.substring(2,4);

var yearYYYY = today.substring(0,4);

var quarter = Math.ceil(month/3);

 

 

var qArrays = ["Q1","Q1;Q2","Q1;Q2;Q3","Q1;Q2;Q3;Q4"]; // Arrays of quarters per quarter

 

var quarterArray = qArrays[quarter - 1]; // Get array string of quarters based on current quarter

var quarterList = quarterArray.split(";");  // Convert string to array


 

//  Loop through quarters to date and add to listbox

quarterList.forEach(function(quarterItem, quarterKey) {

  LISTBOX_1.addItem(yearYYYY + (quarterKey + 1), quarterItem + " - " + yearYY);

});

 

 

When you subsequently apply DD1.getSelectedValue(), the quarter key should be returned in the required YYYYQ format.

 

 

Regards,

 

Mustafa.


Viewing all articles
Browse latest Browse all 3189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>