Author Message
Andrew.Prokop
Joined: Oct 28, 2014
Messages: 179
Offline
I have a workflow where I pull data in from a web service with a RESTful call. I take the returned JSON data and put it into a Breeze object variable. I want to pull one value out (a sensor temperature) and compare it against a constant.

The Breeze value looks like this: TelemetryObject["data"][4]["floatValue"]

TelemetryObject["data"][4]["floatValue"] was created as a Number.

I want to compare it against a variety of min and max temperatures that I want to set through Properties. However, Properties are strings and cannot be compared against number values.

How can I make this work.

I want something like this: TelemetryObject["data"][4]["floatValue"] > Properties["TempMax"]

Is there a way for me to convert Properties["TempMax"] to a number?

Either that, is there way to create a Property that is a number and not a string?
JoelEzell
Joined: Nov 15, 2013
Messages: 780
Offline
Hi Andrew, in your expression editor, did you notice the little box on the lower right that says "Functions"? If you pop that open, you'll find a wealth of different string / number / math functions. I'm afraid I can't tell you exactly which buttons to push in the right order to get your desired result, but with a little trial and error you may be able to figure it out. One of our Engagement Designer experts is out of the office today but will check this thread tomorrow and offer further guidance if you've not been able to figure it out.
Andrew.Prokop
Joined: Oct 28, 2014
Messages: 179
Offline
Thanks, Joel. I see that, but I still don't understand how to convert a String to a Number (which is what I think I need for the ">" operation).

I need to know what I can to do this: Properties["TempMax"].

I've tried a bunch of them, but they always give me a validation error.
JoelEzell
Joined: Nov 15, 2013
Messages: 780
Offline
Yeah, I wasn't able to figure that out either after playing around with it for a minute. Hopefully Prakash can enlighten us tomorrow.
AnuragAggarwal
Joined: Jun 1, 2014
Messages: 154
Offline
In Extra Functions, there is parseInt(String)

you can use

TelemetryObject["data"][4]["floatValue"] > parseInt( Properties["TempMax"] )
Andrew.Prokop
Joined: Oct 28, 2014
Messages: 179
Offline
I tried that yesterday. I receive:

• Function 'undefined' requires [2] arguments.

My exact call:

TelemetryObject["data"][4]["floatValue"] > parseInt( Properties["TempMax"] )

I have it inside the Condition following an Exclusive Gateway.
AnuragAggarwal
Joined: Jun 1, 2014
Messages: 154
Offline
seems like a bug in latest ED code, parseInt should be allowed with just string or string and radix

Seems like just string s broken for now, i would log a defect

in meantime you can use string, 10

TelemetryObject["data"][4]["floatValue"] > parseInt( Properties["TempMax"], 10 )
Andrew.Prokop
Joined: Oct 28, 2014
Messages: 179
Offline
Thanks. That did it. In case someone wants to investigate and fix the bug, it's happening on lab 158.
AnuragAggarwal
Joined: Jun 1, 2014
Messages: 154
Offline
Thanks for the information on lab 158, and nice it worked for you, we may not need lab (this is easy to reproduce)
adomanim1
Joined: Jan 10, 2020
Messages: 2
Offline
Try to find a math formula to solve the problem.

Maybe, knowing the Math.abs() in Java will be useful ...
Go to:   
Mobile view