Named Query not returning correct dimensions dataset

Hey guys,

I have a named query (let's call it GetDataset). The named query has 5 parameters. The parameter values can make the table have either 12 columns or 13 columns.

I am binding my table's data to the named query. However, no matter what parameter values I use, the dataset returned by the named query is only giving 12 columns worth of data.

The interesting thing is when using the same parameters in the named query testing region, I am able to confirm both 12 columns and 13 columns showing at appropriate times.

Are tables not allowed to have dynamic number of columns from named queries?

We will need to know how you have configured the table.

Basically, if you have elected to configure the columns of the table using the Columns Prop and you haven't added all 13 columns then the 13th column will never display, even if it is available in the data.

If you need to use the columns prop due to specific styling requirements then you will need to dynamically produce the columns prop based on the shape of the data.

2 Likes

Thanks for the reply.

I do have all 13 columns defined in the Columns Prop. But the named query itself is still returning a 12 column dataset regardless. I was thinking it may have to do with the column definitions, but at this point it seems like some kind of bug honestly.

For testing purposes, I made another table with 2 defined columns and the same parameters for the named query. The named query still gives me 12 columns instead of 13... even with only 2 defined columns

Also just as an FYI, the stored procedure i am using for the named query returns its results by using a dynamic SQL statement ... not sure if thats related to the issue

This suggests that the parameters being sent to the named query are not what you believe them to be.

I take this to mean that you are using an Execute instruction in the named query, in which case this should not have any effect on the named query function as, the stored procedure would be executed on the database. If instead you mean that you are using a "dynamic script" inside of the named query, then that could be an issue, as JDBC does not support SQL Scripts. I would still find it odd if the query executes correctly in the testing section of the Named Query editor, that it wouldn't then execute correctly by a call.

I am also assuming that you are using a query binding to execute the named query (which you should). What is returned by the query if you use an expression binding with an expression similar to this:

runScript("system.db.runNamedQuery('YourNamedQuery',params={'param1':param1Value,'param2':param2Value}))

The parameters actually were being sent to the named query properly as I was manually inputting the same values I used in the testing region.

For the dynamic SQL statement, yes I have an "EXEC sp_executesql @SqlQuery" within my stored procedure

I actually ended up fixing the issue by deleting the Named Query and re-creating the same exact one again. Perhaps it was just a weird bug?

Appreciate the help nonetheless :slight_smile:

Glad you got it fixed, I wonder if perhaps you had a result set cached or something. Oh well, its working so that's the important thing.