Skip to main content
1-Visitor
July 22, 2015
Question

Is it possible to create a direct link to a chart replacing the default query for the Chart?

  • July 22, 2015
  • 2 replies
  • 2118 views

All,

     I am looking for a way to create a hyperlink to a chart that replaces the defined query of the chart with one I specify.  I can successfully call a chart using this format: http://{hostname}{port}/im/runchart?selection={chartname} and I can call a report replacing the query with this call : http://{hostname}:{port}/im/runreport?queryDefinition=(field[ID]={id})&selection={reportname}‌.  Is there a different format for the call that I need to use for the Chart or is this unsupported?




Thank you,



Paul Hartwig

2 replies

5-Regular Member
July 22, 2015

Paul, you should be able to use these options, to override the query, for a chart (even via a Web URL):

1. --query                      Override chart query with this query at run time.

2. --queryDefinition        Override chart query with this query definition at run time.

Make sure you're putting this after the selection option and value, in your runchart URL/call.  It may be getting confused with that.

16-Pearl
August 27, 2015
16-Pearl
July 26, 2021

UPDATE: for PTC version > 12.x and higher

the API is now more restrictive regarding special character encoding.

Therefore the braces '[' ( == %5B) and ']' (==%5D) have to replaced as well as the '=' (== %3D) in the queryDefinition

so to 

 

run a report

this call : http://{hostname}:{port}/im/runreport?selection={reportname}&queryDefinition=(field%5BID%5D%3D={id})

 

or to run a chart

this call : http://{hostname}:{port}/im/runchart?selection={chartname}&queryDefinition=(field%5BID%5D%3D={id})

 

 

works fine for us.