cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate alerts on the combination of values of 2 properties.

Highlighted
Newbie

How to generate alerts on the combination of values of 2 properties.

I have 2 properties and I want that when the value of both these values cross a threshold value then only a alert should be generated and not just on one property.

Tags (2)
9 REPLIES 9

Re: How to generate alerts on the combination of values of 2 properties.

Make a service that will check values of both properties and if both of them are above threshold , return true which you can be saved on another  Boolean property .

Generate an alert when this Boolean property is true.

Let me know if you find this useful.

Re: How to generate alerts on the combination of values of 2 properties.

You can create a subscription to value change on one of the properties or both, and there check the threshold, once detected the alert you can throw it by hand through a service, or build you own alerts system.

Re: How to generate alerts on the combination of values of 2 properties.

How to generate an alert through a service, because there is no snippet as to generate an alert.

Re: How to generate alerts on the combination of values of 2 properties.

me.AddOrUpdateAlert

Re: How to generate alerts on the combination of values of 2 properties.

Hi Carl,

Im comparing the value of latitude and longitude to a specific value and if it matches then we are generating the alert. My Subscription code is fired on data change of latitude property. My code looks like this

var latitude=String(me.lat);

var longitude=String(me.long);

if(latitude.equals(18.581172) && longitude.equals(73.682556))

{

var params = {

  alertType: EqualTo /* STRING */,

  alertName: Alarm /* STRING */,

  property: me.lat /* STRING */,

  description: 'RMC departure for delivery' /* STRING */,

  attributes: undefined /* INFOTABLE */,

  priority: 1 /* INTEGER */,

  persistent: true /* BOOLEAN */,

  enabled: true /* BOOLEAN */

};

me.AddOrUpdateAlert(params);

}

Re: How to generate alerts on the combination of values of 2 properties.

Hi,

Which it's the question?

A part, why don't you use LOCATION baseType? then you will have only one property.

Best Regards,

Carles.

Re: How to generate alerts on the combination of values of 2 properties.

Because we are getting the location from the device in the form of latitude and longitude separately and then convert it into a location object and bind it to google map.

Re: How to generate alerts on the combination of values of 2 properties.

Just on this issue, I'm trying to convert separate Lat and Long numbers in Javascript to a Location type but it doesn't seem to be working. Do you have some kind of code snippet?

Re: How to generate alerts on the combination of values of 2 properties.

This is the correct way of building a TW LOCATION baseType:

var result = { latitude: 1.4, longitude: 0.4, elevation: 0, units: "WGS84" };

Best Regards,

Carles.