Forum Discussion
Error importing DBF files when MDX present
I'm trying to import the results from hyraulic simulation software into Power BI Desktop. The output from the hydraulic software is a bunch of .dbf files. I've figured out how to import .dbf files into Power BI using the code below. However, the hydraulic simulation software also generates .mdx files, which I think are an index for the .dbfs. If there are any .mdx files present at the location of the .dbf file I want to import, I get the error shown below. The only solution I've found so far is to delete the .mdx files before refreshing Power BI, which will be tedious to do every time. Can anyone help? Is there a better way to write the query so I don't get these errors?
let
Source = Odbc.DataSource("dsn=dBASE Files", [HierarchicalNavigation=true]),
Database = Source{[Name=MyPath,Kind="Database"]}[Data],
Table = Database{[Name=MyFile,Kind="Table"]}[Data]
in
Table
7 Replies
- lbendlinSuper User
Is there any chance that your hydraulics software can export a format that is a little more, uhm, contemporary?
- cricksFrequent Visitor
Realized I replied to myself instead of to lbendlin.
The data is stored in a .out file, which can only be read by the software. You can check a box to export results for external use, but there is no option to specify a file type. I have suggested an option to export to another format, but I have no idea if or when they will implement it.
- Syndicate_AdminAdministrator
Hello I am with the same error from several machines, except from one. I don't know how to fix it, you were able to move forward with something? Thanks a lot
- cricksFrequent Visitor
My best solution was to delete the .mdx files using some Python code at the start of the query. Not ideal because the user must have Python installed, but it works.
= Python.Execute("import os#(lf)#(lf)folderpath=r"""&Text.From(#"Model Output Path")&"""#(lf)#(lf)for parent, dirnames, filenames in os.walk(folderpath):#(lf) for fn in filenames:#(lf) if fn.lower().endswith('.mdx'):#(lf) os.remove(os.path.join(parent, fn))")
- Syndicate_AdminAdministrator
Of course. My drawback is that DBFs are used by a very old CRM. I want to be able to link to the dbf to be able to get reports and processes, while still operating live with that application. I wouldn't be able to clear the mdx unfortunately. What continues to strike me notoriously is that a machine of the whole company can establish the link, but all the others cannot.
- lbendlinSuper User
Sounds a lot like Access - most likely these MDX files are there for a reason, to prevent multi user access to the same database file. Might also expain why it works for one machine but not all the others.
- Syndicate_AdminAdministrator
The strangest thing is that previously it did work on all machines and from one day to the next it stopped doing so. I installed the program locally on my machine with which I use Microsoft Office 365 and something similar happens to me, the error that appears when wanting to link them is, the system resources were exceeded (while the mdx is present) and in this way nobody has access to the file except me ... I don't know, it's very weird