cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Connor888
Frequent Visitor

Feed a parameter to an external data connection (ODBC)

Hello! 

 

I'm trying to build a query which connects to an external database with ODBC, but only retrieves a certain line of data determined by an input table in excel, which just has a single cell with an item number in it. 

 

What I've tried to do is as follows (simplified because the SQL is loooong):

 

ExtData = Odbc.Query("dsn=myexternalsource","select * from FILE where ItemNumber ='" & Variable & "'"

 

Where 'Variable' is from the input table loaded elsewhere. This gives me a firewall error, as a step can't reference an external data source and another query. 

 

I can get around  this by just loading the whole table and then inner joining or filtering with the input table, but this will be slower than passing the request off to the server to do it for me since the file I'm querying is very large and I'm retrieving a lot of data. The question is, is this possible?

 

Thanks! ☺

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Feed a parameter to an external data connection (ODBC)

Hi @Connor888 ,

 

Because of Query isolation, it is hard to query another data source by refer another query, but it should work if you query them in the same query, such as following:

 

let
  Source = get...excel...file...from.connector.instead.of.another.query,
  Line = get...certain...line...from...Source,
  Variable = get..itemnumber..from..Line,
  ExtData = Odbc.Query("dsn=myexternalsource","select * from FILE where ItemNumber ='" & Variable & "'"
in
  ExtData

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

Re: Feed a parameter to an external data connection (ODBC)

Hi @Connor888 ,

 

Because of Query isolation, it is hard to query another data source by refer another query, but it should work if you query them in the same query, such as following:

 

let
  Source = get...excel...file...from.connector.instead.of.another.query,
  Line = get...certain...line...from...Source,
  Variable = get..itemnumber..from..Line,
  ExtData = Odbc.Query("dsn=myexternalsource","select * from FILE where ItemNumber ='" & Variable & "'"
in
  ExtData

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors