This becomes handy when having to enter a time range with a start and end date (week, month, quarter, year, etc).

The trick is to make always sure that the to-date cannot lie below the from-date. This can be done via a check and a message afterwards, but better is to help the user immediately.

Below an example using calmonth.

We must go from:                          To:

     

To do this, use the following code.

On Startup:

LISTBOX_FROM.setItems(DS_1.getMemberList(“0CALMONTH”, MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 24));
LISTBOX_TO.setItems(DS_1.getMemberList(“0CALMONTH”, MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 24));

On Select (LISTBOX_FROM):

 

var arr_calmnth = DS_1.getMembers(“0CALMONTH”, 24);
var lv_string = “”;
var lv_ix = 0;
LISTBOX_TO.removeAllItems();
arr_calmnth.forEach(function(element, index) {
         if (element.internalKey == LISTBOX_FROM.getSelectedValue())
         {lv_ix = index;    }
});
arr_calmnth.forEach(function(element, index) {
  if (index >= lv_ix) {
         LISTBOX_TO.addItem(element.internalKey , element.text);
         }
});

On Click (OK button):

var lv_perfrom = LISTBOX_FROM.getSelectedValue();
var lv_perto = LISTBOX_TO.getSelectedValue();
DS_1.setFilter(“0CALMONTH”, [{“low”: lv_perfrom, “high”: lv_perto}]);

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply