Converting String into int

I am trying to write a function but the value that returns is a sting and I am trying to graph it.

“-66 dBm”

I want to convert this into a int and graph it. Is there a way to do this in the functions section?

left(“-66 dBm”, 3) – ? not sure if this is supposed works?

If you have a list of command that I could use and how they work I can probably figure it out.

Here is the function:

Available: if((oid(“1.3.6.1.4.1.161.19.3.2.2.1.0”) = “REGISTERED”), 1, 0)
Error: if((oid(“1.3.6.1.4.1.161.19.3.2.2.1.0”) = “REGISTERED”), “”, “There is a problem”)
Value:
oid(“1.3.6.1.4.1.161.19.3.2.2.8.0”)
Unit: dBm


oid(“1.3.6.1.4.1.161.19.3.2.2.8.0”) returns “-## dBm”


Thanks,

If the number is the first thing in the string then it should be working right
away (if number is expected, but string is given, then it automatically tries
to convert the string to number).

Uldis,

If a string is returned like this “-70 dBm” are you saying this will try and convert this automatically to a number? If that is true is it going to convert it to -70 or 70? Wouldn’t it try and convert the " dBm" also? Can you give me an example how I can convert

“-70 dBm” → -70 or 70

I am not sure if the Dude will graph negative numbers.

Thanks,

Dude will graph negative numbers. Did you try making this a datasource and adding it to a chart to see if it plots?

I have added the “-66 dBm” and it will plot it at 4.5G, not sure what this means, it indicates to me that it isn’t converting it correctly.

I have tried to plot -21 and I don’t get any good results either.

Thank you for your input, there was a bug, that negative values would not be
graphed correctly when using manually created ‘function’ type data sources.
Bug fixed, wait for next release.

shea, if function will return “-100 dBm” dude will graph value -100
automatically

Heres an example of a data source I use. Hopefully this will help others with the whole negative value thing if you really want it to show up as a positive in the Dude.

using 3 beta 6 for a while now…

Subscriber Unit off a Trango 5830 AP:

name: customer RSSI
type: function
data: gauge
scale mode: multiply
scale: 1.000
unit: dBm
rate: none
device: Trango 5830 AP

Code: oid(“iso.org.dod.internet.private.enterprises.trango.tbw.m5830sap.su.suInfoTable.suInfoEntry.suRSSIFromSU.1”) * -1

Interval: 5


Click Test:

got value: 72

My problem is that if I go to add this as a line to a graph, it says unknown type in red and won’t let me add it. What gives? Ideas?