It's been almost 9 years @Eduard Lebedyuk :-) Have ever figured out how to call a linked procedure when running a select for data from a linked table?

When I execute a select statement with only the call to the linked stored procedure, all works ok:

select CRMBI.getPlanningRate(11,2023)

Expression_1
0.94

1 row(s) affected

But if I try to make that same call within a query to another table in that same package, I get errors:

select ISCurrencyID, CRMBI.getPlanningRate(ISCurrencyID,2024) from CRMBI.CurrencyRate

  [SQLCODE: <-223>:<Gateway query Prepare() failed>]

  [%msg: <Connection 'CRMBILINKTABLES': Prepare(select T1.ISCurrencyID AS C1,(T1.ISCurrencyID...): SQLState: (42000) NativeError: [1] Message: [Iris ODBC][State : 42000][Native Code 1] [c:\intersystems\iris2021v1\bin\irisdb.exe] [SQLCODE: <-1>:<Invalid SQL statement>] [Location: <Prepare>] [%msg: < ) expected, , found ^SELECT T1 . ISCurrencyID AS C1 , ( T1 . ISCurrencyID ,>] >]

Other queries to the linked table, without the stored procedure, also works just fine:

select ISCurrencyID, USDRate, effectiveDate from CRMBI.CurrencyRate where ISCurrencyID = 11 and effectiveDate > '2022-12-31' and effectiveDate < '2023-01-31'
 

ISCurrencyID USDRate effectiveDate
11 0.9392000 2023-01-01

1 row(s) affected

 

Might be user error or a later message to the WRC, but thanks in advance if you have any ideas.

Thank you Dmitry; I confirmed it works when the dynamic arrays are stored in variables:

%SYS>w $zv
IRIS for Windows (x86-64) 2024.1.1 (Build 347U) Thu Jul 18 2024 17:35:51 EDT
%SYS>set arr1 = [1,2,3]
 
%SYS>set arr2 = [6,5,4]
 
%SYS>zw arr1.addAll(arr2)
[1,2,3,6,5,4]  ; <DYNAMIC ARRAY>
 
%SYS>do arr1.addAll(arr2)
 
%SYS>zw arr1
arr1=[1,2,3,6,5,4,6,5,4]  ; <DYNAMIC ARRAY>

I'm a big fan of the "old-school" debugging technique of embedding code to store interesting data into globals for later review after running the code to be debugged.

In ObjectScript, the command would look something like this:

Set ^mtempJJM("test", $i(^mtempJJM("test")) = "self=<"_self_">, "_name=<"_name_">"

And then from terminal, issuing this command:

zw ^mtempJJM("test")

One can do something similar in Python using the syntax described on the pages linked below (syntax on how to increment the global index is left to the reader 😀 ):

https://docs.intersystems.com/iris20242/csp/docbook/DocBook.UI.Page.cls?...

Global Reference API | Using Embedded Python | InterSystems IRIS Data Platform 2024.2
 

An update on this...

I had assumed that all was configured properly on the Report Server, particularly with respect to the required connections and gateways as described here: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

I was mistaken. Also, we are running an older version of the report server (Version 1.12.7981.11681, from Sept. 2021), which does not provide the "New data source and gateway management experience" introduced in May, 2022.

We're planning an upgrade of our Power BI Report Server and backing SQL Server and I'll revisit the use of DirectQuery to IRIS with some of our reports after that upgrade.

Thanks again Carmen for the pointers and I'll update this post after getting this working as expected.

Hi Carmen, thank you for the clarification on the "Import mode" recommendation and for the link to something to try. Unfortunately, although the report shows up in the right spot on the report server, when I try to "Manage" the "Data Sources", that link is greyed out:

 

I don't believe it's a folder/file permissions issue since I've saved other reports to this folder before.

The example in the link you sent me used Direct Query to the SQL Server for its data. Since report configuration information is also stored in SQL Server and my report has no explicitly-defined connection to SQL Server, could that be an issue?

I'm now looking at the backend SQL Server database where report information is stored for clues. I've found "rsInternalError" entries in the "....ExecutionLogStorage" table for each of the times I've tried to display the problem report from the server, but now looking for details of these errors.

I'll update this post with more details as I find them, but other ideas (how to enable the "Data sources" link?) are most welcome.

Thanks again,

Jean