Followup to the Spectrum Optimization and Customization class.   Display attributes in subviews in a humanly consumable way

Document created by macad02 Employee on Aug 9, 2017Last modified by macad02 Employee on Sep 28, 2017
Version 2Show Document
  • View in full screen mode

Followup to Spectrum Optimization and Customization Class: Display attributes in subviews in a humanly consumable way.

In module 6 of the Optimization and Customization class we learned to display attribute values in OneClick subviews.
We created a subview that looked similar to the following:

Unfortunately we did not spend much time discussing how to display this information in a humanly consumable format. Without units, most of these values being displayed are useless.

For example, there is a big difference between 52 DC volts and 52 AC volts. Without units, that information is useless.

There are several ways we can add units to these attribute values.


Let us consider the easiest way, which is to add the units to the displayed name:
<column>
   <name>Battery Voltage (DC volts)</name>
   <content>
      <attribute>0xfff00025</attribute>
   </content>
</column>

 

This will look like:

 

We can display these units in a more natural way with the use of an <expression>:
<column>
   <name>Battery Voltage</name>
      <content>
         <attribute>0xfff00025</attribute>
         <expression>value().toString() + " DC volts" </expression>
      </content>
</column>

 

This will look like:

 

Let us consider what the meaning of "Send Trap Type" and "Trap Level". We need to investigate those attributes:


Both "Send Trap Type" and "Trap Level" are data type integer and readable/writable. They are also enumerations which means there is a word equivalent to those integer values.

It will be much more useful for the Operators to see the word equivalent instead of the integer value. To do this we need use the enumerated attribute renderer. We can also make this column editable.
<column>
   <name>TRAP Level</name>
      <content>
         <attribute>0xfff0006b</attribute>
         <renderer>
            <param name="attrID">0xfff0006b</param>
            com.aprisma.spectrum.app.util.render.EnumeratedAttrRenderer
         </renderer>
      </content>
      <editable/>
</column>

 

This will look like:

 

Finally, let us consider Battery Time Remaining. Although it is technically accurate to show the time remaining as 1131 seconds, it is not very easy for most people to competely comprehend exactly how much that that represents.
Displaying that time in Minutes, would make it easier to understand. We can do this with an <expression> to divide the raw value by 60.
<column>
   <name>Battery Time Remaining</name>
      <content>
         <attribute>0xfff00024</attribute>
         <expression>attrInt(0xfff00024) /60</expression>
         <expression>value().toString() + " Minutes" </expression>
      </content>
</column>

 

This will look like:

 

The problem here is that 1131 seconds is NOT exactly 18 minutes.
It is very close to 19 minutes.

 

We can represent it as a rational number:
<column>
      <name>Battery Time Remaining</name>
      <content>
         <attribute>0xfff00024</attribute>
         <expression>attrDouble(0xfff00024) /60</expression>
         <expression>value().toString() + " Minutes" </expression>
      </content>
</column>

 

This will look like:

 

The problem here is that people typically do not understand .85 minutes.
This not a good way of displaying time. If time is too small, we get a decimal value. If time is too large we end up with our original problem (e.g. 197 minutes).

 

We need to investigate a better way of displaying time. We can always use a method that Spectrum Engineering uses. SysUptime is a representaiton of time that is very easy to read.

 

There is a system up time render that we can use to achieve this format. but to use it correctly we need to investigate the units of sysUpTime.

Looking up sysUpTime in Mib tools reveals that the raw units are hundredths of a second.

To implement the SysUpTimeRenderer we will have to convert the Battery Time Remaining to hundredths of a second.

<column>
   <name>Battery Time Remaining</name>
      <content>
         <attribute>0xfff00024</attribute>
         <expression>attrInt(0xfff00024) *100</expression>
      </content>
      <swing-cell-template>
         <text>
            <renderer>com.aprisma.spectrum.app.util.render.SysUpTimeRenderer</renderer>
         </text>
      </swing-cell-template>
</column>


This will look like:

 

When you attempt to display attribute data to your Operators, it is extremely import for you to display the information into a humanly consumable format.

 

I hope you enjoyed the solution!

 

 

 

Here is a link to this information in the Wiki Product guide:

XML Usage Common to All Customization Files - CA Spectrum - 10.2 and 10.2.1 - CA Technologies Documentation 

 

Here is a link to a video I made about this subject:

Formatting Data Displayed in CA Spectrum® OneClick Subviews 

6 people found this helpful

Attachments

    Outcomes