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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

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

psaxena
1-Visitor

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.

9 REPLIES 9
rupadhyay
12-Amethyst
(To:psaxena)

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.

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.

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

me.AddOrUpdateAlert

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);

}

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.

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.

oschenk
1-Visitor
(To:psaxena)

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?

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.

Announcements


Top Tags