Don:

Unfortunately, because you have so many integer codes, you must also remember 
that there is a 256-character limit on each line of code (this only applies to 
non-commented characters). To work around this, set up multiple sub-conversions 
and a super-conversion based on the ranges of the sub-conversions. I do this 
quite frequently, and now I usually can do it without typos. If you make typos, 
its very difficult to debug; but if you're careful it should work perfectly. I 
don't think there is a better way to handle Integer-to-Text conversion 
currently (though I'm pushing for one!).

Here is some example code from one of my probes (com.dartware.ups.apc):

<!-- 
{noTransfer(1),highLineVoltage(2),brownout(3),blackout(4),smallMomentarySag(5),deepMomentarySag(6),smallMomentarySpike(7),largeMomentarySpike(8),selfTest(9),rateOfVoltageChange(10)}
 -->
fail1,        ($failCode=1)?"No Transfer":($failCode=2)?"High Line 
Voltage":($failCode=3)?"Brown Out":($failCode=4)?"Black 
Out":($failCode=5)?"Small Brief Sag":($failCode=6)?"Deep Brief Sag":"(!)Unknown 
Input Failure Code",  CALCULATION
fail2,        ($failCode=7)?"Small Brief Spike":($failCode=8)?"Large Brief 
Spike":($failCode=9)?"Self Test":($failCode=10)?"Rate of Voltage 
Change":"(!)Unknown Input Failure Code",  CALCULATION
failCause,    ($failCode<7)?"$fail1":"$fail2", CALCULATION

For easier viewing, you might want to copy these four lines to a monospace, 
non-wrapping editor.

Jon Jacobson
Consultant for Dartware, LLC

--- Previous Messages:
Sorry, the backslash escape of the newline doesn't work. The entire expression 
has to be on one line. This makes it a bit unwieldy.

Bill Fisher
Dartware, LLC


On Aug 22, 2005, at 1:07 PM, Levinson, Don A. wrote:

--- Start of quoted text:
Will this work in 4.3.1? My event log is giving me errors:
08/22 09:05:34  dbug  biz.awwu.snmp.designjet: Can't match " PAPER_TYPE,
($TRAY1_MEDIA_TYPE == 3) ? "Plain Paper" :  \

"
08/22 09:05:34  dbug  biz.awwu.snmp.designjet: Can't match "
($TRAY1_MEDIA_TYPE == 32735) ? "White Inkjet Paper" :  \

...
--- end of quoted text ---


--- Start of quoted text:
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of William W.
Fisher
Sent: Friday, August 19, 2005 5:34 AM
To: InterMapper Discussion
Subject: Re: [IM-Talk] SNMP string comparison

Don:

You can use the ?: syntax in a calculation:

paperType,      ($media1 == 3) ? "Plain Paper" :  \
                        ($media1 == 32735) ? "White Inkjet Paper" : \
                        ($media1 == 32736) ? "Thin Natural Tracing" : \
                           "Unknown ($media1)",
CALCULATION, "Paper Type"
Regards,

Bill Fisher
Dartware, LLC



On Aug 18, 2005, at 10:01 PM, Levinson, Don A. wrote:

--- Start of quoted text (2):
Is there a way to take a SNMP numeric variable and compare it to a
table of static values to return the string associated with that
value? Some kind of if/then or case/next syntax?

The variable is
        TRAY1_MEDIA_TYPE,                       ${HP-PML}.1.4.1.3.3.1.6,
DEFAULT,        "Media Type"
And the table is
                                             3      Plain Paper
                                             32735  White Inkjet Paper
                                             32736  Thin Natural
Tracing
                                             32752  Natural Tracing
Paper
                                             32753  Coated Paper
                                             32754  Clear Film
                                             32755  High Gloss Photo
                                             32756  Semi-Gloss Photo
                                             32758  Heavy Coated Paper
                                             32764  Vellum
                                             32767  Translucent Bond
                                             32768  Matte Film
                                             32750  Imaging Film
Backlit
                                             32757  High Gloss Film
                                             32749  Opaque Vinyl\0mp\
--- end of quoted text (2) ---


____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]


____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]
--- end of quoted text ---


____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]
--- end of quote ---



Jon Jacobson
Consultant for Dartware, LLC.

____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]

Reply via email to