Jump to content
Changes to the Jaspersoft community edition download ×

JSON query: Invalid attribute selection expression when dot character in value


dann

Recommended Posts

Hi,

When passing a value with a dot in it, the JSON query parser crashes.

I reproduced it with the Northwind example, and modified a single CustomerID so it would contain a dot: "test.1"

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRException: Invalid attribute selection expression: Orders(CustomerID == test.
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:536)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: net.sf.jasperreports.engine.JRException: Invalid attribute selection expression: Orders(CustomerID == test.
    at net.sf.jasperreports.engine.data.JsonDataSource.goDownPathWithAttribute(JsonDataSource.java:362)
    at net.sf.jasperreports.engine.data.JsonDataSource.getJsonData(JsonDataSource.java:340)
    at net.sf.jasperreports.engine.data.JsonDataSource.moveFirst(JsonDataSource.java:172)

This seems to break a lot of real use cases, where e.g. an e-mail address is used for an id.

 

Any suggestions for a workaround?

 Dann

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

This is one of the limitations of the JSON based querys. Try switching to JSONQL and set a filter expression like: (CustomerID == "test.1")

If you are using the northwind.json file from the jsondatasource sample a query to select and filter the Orders would look like so:

Northwind.Orders.*(CustomerID == "test.1")

More info on JSONQL could be found here: http://jasperreports.sourceforge.net/sample.reference/jsonqldatasource/index.html#jsonql

M

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...