Virtual Parameters in Chart Issue

I can’t seem to pull VirtualParameter details to show in the chart. Is there a specific way this should be done? I am attaching what I have tried so far without success. I am trying to use a Virtual Parameter as we use multiple modules of devices that each show their PCI in a different variable.

Chart Code:

online_PCI_24:
  label: "'Online Status PCI 24'"
  slices:
    1_onlineNow:
      color: "'#31a354'"
      filter: Tags.DEPLOYED = true AND VirtualParameters.phyCellID = 24 AND Events.Inform > NOW() - 5 * 60 * 1000
      label: "'Online now'"
    2_past24:
      color: "'#ffde24'"
      filter: Tags.DEPLOYED = true AND VirtualParameters.phyCellID = 24 AND Events.Inform > (NOW() - 5 * 60 * 1000) - (24 *
        60 * 60 * 1000) AND Events.Inform < (NOW() - 5 * 60 * 1000)
      label: "'Offline in past 24 hours'"
    3_others:
      color: "'#ff2424'"
      filter: Tags.DEPLOYED = true AND VirtualParameters.phyCellID = 24 AND Events.Inform < (NOW() - 5 * 60 * 1000) - (24 *
        60 * 60 * 1000)
      label: "'Offline over 24 hours'"

Virtual Parameter Code: VirtualParameters.phyCellID

let result = '';
let keys = [
    'Device.Cellular.Interface.1.X_ZYXEL_PhyCellID',
    'InternetGatewayDevice.WANDevice.X_BEC_COM_ModuleA.PhyCellID'
];

for (let key of keys) {
    let k = declare(key, {value: Date.now()});
    if (k.size) {
        result = k.value[0];
        break;
    }
}

return {writable: false, value: [result, "xsd:string"]};

I suggest to forget about chart at first. Add the VP to the index page and make sure you can see it filled for all devices.

Read the Note

never forget to mention the genieacs version you are using. also (offtopic) I suggest to rename “Online” to “Last 5 mins” or similar to avoid confusion.

The act of creating a virtual param does not automatically refresh that data for that VP. This is a trap that many people fall into.

Look in your inform provision script and verify that the VP is being refreshed on an appropriate interval.

I’m sucessfully using VParams in my charts:

access_past_24:
  label: '"Access"'
  slices:
    1_ethernet:
      color: "'#44b3c2'"
      filter: VirtualParameters.WANAccessType = "Ethernet" AND Events.Inform > NOW() -
        24 * 60 * 1000
      label: "'Ethernet'"
    2_dsl:
      color: "'#c58744'"
      filter: VirtualParameters.WANAccessType = "DSL" AND Events.Inform > NOW() - 24 *
        60 * 1000
      label: "'DSL'"
1 Like

Thanks! Realized my mistake was not putting quotation marks around the variable.