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

Re: How do you sort months from a UNX universe with Design Studio?

$
0
0

Hi,

 

here is your code - you need a button and a listbox to run it in your app.

 

var years = ["2012", "2013", "2014", "2015"];

var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

 

 

var unsorted = ["Apr 2013", "Jan 2013", "Jun 2013", "Sep 2012", "Oct 2014", "Dec 2013"];

 

 

// create big string

var allUnsortedMonths = "";

unsorted.forEach(function(element, index) {

  allUnsortedMonths = allUnsortedMonths + ";" + element;

});

 

 

years.forEach(function(year, indexYear) {

  months.forEach(function(month, indexMonth) {

   var monthYear = month + " " + year;

  

   // if this combination is there in unsorted array as string

   if(allUnsortedMonths.indexOf(monthYear) > -1) {

    LISTBOX_1.addItem(monthYear, monthYear);

   }

  });

});

 

this should help you, even w/o any SDK components. the unsorted array needs to be replaced by the method which is returning your months from datasource


Viewing all articles
Browse latest Browse all 8088

Trending Articles



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