Sum between dataslotes type Date in a String

Posted by DannyGeerts on 08-Dec-2010 07:58

In a project i got 3 dataslots. 2 dates and 1 string.

Got 2 dates and what a number of days between those to in an string field (or other type if String does not work.

Date 1 = 03-01-2010

Date 2 = 01-01-2010

String 1 = 2

so there are 2 days between the dates.

OnChange of one of those days a string value has to be calculate the number of days between de dates fields.

How can i handle this

All Replies

Posted by dpandey on 08-Dec-2010 11:04

Hello Danny,

You may use the following pre/post script for your requirement:


var d1=jst.getDataSlotValue("Date1");
var d2=jst.getDataSlotValue("Date2");
var d3=d1-d2;
var d4=d3/(1000*60*60*24);
var d5=Math.round(d4);
jst.putDataSlot("numDS", d5);


Where Date1, Date2 are the date dataslot and numDS is Number dataslot.



Posted by DannyGeerts on 09-Dec-2010 03:13


Thanks voor the quick reply!

But i'm sorry to say i still can't get it working.

I used this:

var d1 = sbm.util.getValue('endDate');
var d2 = sbm.util.getValue('tolerenceDate');
var d3 = d1-d2;
var d4 = d3/(1000*60*60*24);
var d5 = Math.round(d4);

Note: i use a WebApplication so don't think i can use the jst. syntax?!

Is there also a date without the time available?



Posted by pzuwekar on 10-Dec-2010 05:05

Yes. date dataslot is of two types,

1. Date and Time. 

2. Date Only.

This date configuration can be selected in BPM Studio> Application> Dataslots tab>> double click> Default Format tab>Type.

In case if you face any issues, please send me your test application and i will modify it as per your requirement.

Thank you,


Posted by DannyGeerts on 10-Dec-2010 06:55

Thanks Parshuram,

The date is now without Time.

But still got the problem with de sum between the 2 dates in my webapplication.



Posted by pzuwekar on 10-Dec-2010 07:49

Please try below code,

var t1 = new Date(document.form.d1.value);
var t2 = new Date(document.form.d2.value);
var t3 = t1-t2;
var t4 = t3/(1000*60*60*24);
var t5 = Math.round(t4);

d1 and d2 are date dataslot names. Please find attached sample application and let me know it helps.

This thread is closed