marclelijveld / External-Tools-Model-Documentation

This repository includes everything that is needed in order to run the External Tools capability in Power BI Desktop and generate Model Documentation.
https://data-marc.com/model-documenter/
MIT License
111 stars 43 forks source link

Doesn't work with spaces in database name #18

Closed rudzimj closed 3 years ago

rudzimj commented 3 years ago

I have a Power BI report that connects to a SSAS on-prem database that has spaces in the name. The current PowerShell script only uses the first word as the database name.

Log:

Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\temp\Data-Marc_WriteConnectionDetailsToFile.ps1 server_name My database name
Your Power BI Model currently runs with the following connection details:
Server:  server_name
Database:  My

This is the code that picks up the database name: $DatabaseName = $args[1]

I'm not a PowerShell expert, but I was able to fix this with the following code:

$DatabaseName = $args[1]
for ($i = 2; $i -lt $args.count; $i += 1)
{
    $DatabaseName = $DatabaseName + ' ' + $args[$i]
}
marclelijveld commented 3 years ago

Hi @rudzimj,

Please know that live connected models are not supported at this moment. Even if the PowerShell script had captured more than only the first word, you would have run into issues.

This is a known limitation of the tool. In order to make the tool work, you have to load the model into active memory of the computer.

--Marc