Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DamianDavies
Frequent Visitor

Paginated report parameters and IBM i (iSeries) DB2 using ODBC error

I am trying to build query parameters into a Power BI Report Builder paginated report from an iSeries DB2/400 database but it gives the following error:

 

ERROR [42S22] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0206 - Column or global variable @PCCODE not found.

 

Queries without parameters work fine. An example simple select query:

 

select * from PPGLDPKP where PKGLAC = @PCCODE

 

I have scoured the Internet for help 😞

Any ideas or work arounds much appreciated.

 

Thank you.

2 ACCEPTED SOLUTIONS
DamianDavies
Frequent Visitor

UPDATE:

 

I tried setting up the connection to the iSeries going via SQL as a linked server.  It worked and accepted the query parameters and sent them to the source database fine.  However, the performance was absolutely atrocious!!

 

I have worked around the problem by filtering the query to a small set of data and then using report filters to fine-tune it further.  This works acceptably well for the small record sets I've been testing on so far.

 

d;)

View solution in original post

DamianDavies
Frequent Visitor

Final solution:

1. Create your parameters

2. In the query, use ? for every parameter

3. On the dataset properties parameters page you will get multiple ? parameter slots. Set each to the required parameter in order. The order is important

 

DamianDavies_1-1671603674360.png

 

 

DamianDavies_0-1671603610407.png

 

View solution in original post

5 REPLIES 5
SohaibS
Regular Visitor

I am also using a similar setup iSeries and AS400/db2 server to build a paginated report with Report Parameters. I finally have mine working.
1st create the Parameter with name PCCODE. You can leave default settings on this I believe, my column is an integer, but i left it on text and it works. 

 

2nd Add the parameter reference to your sql
select * from PPGLDPKP where PKGLAC = 'Parameters!PCCODE.Value'

 

This worked for me, hopefully it will work for you too. 

DamianDavies
Frequent Visitor

Final solution:

1. Create your parameters

2. In the query, use ? for every parameter

3. On the dataset properties parameters page you will get multiple ? parameter slots. Set each to the required parameter in order. The order is important

 

DamianDavies_1-1671603674360.png

 

 

DamianDavies_0-1671603610407.png

 

DamianDavies
Frequent Visitor

UPDATE:

 

I tried setting up the connection to the iSeries going via SQL as a linked server.  It worked and accepted the query parameters and sent them to the source database fine.  However, the performance was absolutely atrocious!!

 

I have worked around the problem by filtering the query to a small set of data and then using report filters to fine-tune it further.  This works acceptably well for the small record sets I've been testing on so far.

 

d;)

amitchandak
Super User
Super User

@DamianDavies , You have m parameter  try like

 

"select * from PPGLDPKP where PKGLAC =" _param

 

First, write a query and then modify the code in advance query

Thanks @amitchandak the Paginated Reports Builder doesn't use Power Query Editor as far as I know. I think that's what you're referring to by using an "m parameter" and advanced editor?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.