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

To find a Date Difference in Minutes in Data Collection

$
0
0

Hello Experts.

 

In onre of the requirements, I need to find out Date difference between two datetimes entered as DC.

 

DC Parameter name: START_TIME , Type: Text , Mask: ##:## ##/##/#### , Value: 10:12 05/31/2016

DC Parameter name: END_TIME , Type: Text , Mask: ##:## ##/##/#### , Value: 11:11 05/31/2016


DC Parameter name: TOTAL_TIME , Type: Formula


I have swritten script as: (I have hardcoded ENDTIME as just wantes to see whetehr query works or not)


queryStr = "select datediff(mi , (substring(\'" + START_TIME + "\' , 13 , 4) + \'-\' + substring(\'" + START_TIME + "\' , 7 , 2) + \'-\' + substring(\'" + START_TIME + "\' , 10 , 2) +\'T\' + substring(\'" + START_TIME + "\', 1 , 5) + \':00\' ) , '2016-05-31T11:11:00') AS MINS";

 

result = executeQuery(queryStr);

 

TotalTime = result.get("MINS");

 

exit(TotalTime);

 

But when I perfrom Data Collect, it gives me an error sayong aht START_TIME is not defined.

 

What am I doing wrong here? Or is it that formula/scripts will take only numeric fields even if I am passing it as parameter?

 

Is there any other method to achieve the same?

 

Regards,

Soham


Viewing all articles
Browse latest Browse all 2175

Trending Articles



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