cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a variable in the NODE statement of a web interface dataset?

Highlighted
05 Base Camper

How to use a variable in the NODE statement of a web interface dataset?

Hi,

I'm building a simple dataset to programmatically retrieve dynamic information from the Prognosis REST API.
I need to filter the data using nodegroups, based on a variable I'll provide upon request. The nodegroup where the data will be taken from is a concatenated string comprised of hardcoded strings and the variable.

 

Here is an example to make it clearer:

 

Dataset:

 

  <dataSet>
    <id>getcmaphone</id>
    <query>SELECT * FROM CMAPHONE WHERE DEVICENAME CONTAINS 'SEP' NODE '#Customers\@Customer\Cisco\CUCM\'</query>
  </dataSet>

REST URL:

https://myserver/Prognosis/rest/v1/data/getcmaphone?customer=MyCustomerName

Prognosis seems unable to properly replace the variable in the nodegroup

I get the following error when I try to retrieve this dataset:

Failed to get response from PQL: Unknown node group... #Customers\@Customer\Cisco\CUCM\.

I tried the same thing using irpqlcli, I get the same kind of error.

Would anyone know how I can use this variable as part of the NODE statement?

Thanks

 

1 REPLY 1
Staff

Re: How to use a variable in the NODE statement of a web interface dataset?

Hi Guillaume,

 

Thank you for your query.

 

I see that you're trying to use the parameter in the node clause, but what you're trying to vary is just the customer name within the #Customers node group.

#Customers\@Customer\Cisco\CUCM\

 

Parameters can be used in the node clause, but it cannot be partial like that. If you want, you can change the query like this:

  <dataSet>
    <id>getcmaphone</id>
    <query>SELECT * FROM CMAPHONE WHERE DEVICENAME CONTAINS 'SEP' NODE @NodeGroupPath</query>
  </dataSet>

 

And, then for the REST API, you can substitute NodeGroupPath with  #Customer\MyCustomerName\Cisco\CUCM, like this example below (with proper URL encoding):

https://myserver/Prognosis/rest/v1/data/getcmaphone?NodeGroupPath=%23Customers%5CMyCustomerName%5CCisco%5CCUCM%5C

 

Let me know if you still encounter issues.

 

Thanks,

 

Budi