06/26/2015

An alternative Class CSV Export

Overview

In this article I'll show an alternative way to take a look at the class hierarchy in M-Files by exporting all classes and their properties into a single CSV-file (Comma Separated Value) so that they can be reviewed in Excel.

Intro

Usually when you start to work on a project, you'll want to get an overview first. In a M-File project with a lot of custom metadata, you probably want to know about the classes and their properties.

M-Files Admin

The first and most common way is certainly firing up the M-Files Admin and taking a look at all classes and properties.

While the admin interface works great for interactively exploring and editing the classes, there are also some drawbacks to this method.

  • You need to be an admin
  • There is no central view that allows viewing all classes and their properties at a glance
  • Interactive nature is not a good fit for presentations or working with clients or offline review

Export to Text Format

One logical approach would be to export the metadata into a text format. That way you can get the following benefits:

  • you can use it offline, by printing it out or e-Mailing it to multiple persons
  • you don't need admin access to the server, you don't even need a M-Files installation to view it
  • you can annotate it easily

An export to a Comma Separated Value File seems like a good choice, as it supports structured data and there are a lot of client tools to view and edit it.

The built-in solution

Luckily M-Files comes with an Export List function that does exactly that, it allows the creation of a csv file with all classes as shown in the screenshot below.

The Admin interface allows exporting a list of all classes, by using the context-menu and clicking 'Export List...'

M-Files Screenshot of the Admin Interface 'Export as List...'

The export creates a file whose content mirrors the columns that are shown on the right.

So for the hierarchical view, you only get a list of the object types and in the Flat View you'll get at least a list of classes if you right-click 'classes' and choose 'Export as List...' - but that's not what I wanted.

What I needed

What I needed was a list of all classes and all their properties, like the following:

Class Property Type Required
Agenda Name or title Text True
Agenda Event date Date False
...
Assignment Name or title Text True
Assignment Assignment description Multiline Text False
...

With a list like that, I can sit down with a client and really get to work and answer the important questions like:

  • What properties are missing?
  • Which are of the wrong type?
  • Should this property be required or not?
  • How can we fill this specific property from existing data?

while taking notes and making annotations.

The solution

To solve that problem I wrote a short commandline tool that exports the classes and their properties to a csv file.

Where to get it

You can download it here: MFilesExporter.zip

Download MFilesExporter

How to use it

  • unpack the files into a folder
  • open the cmd prompt by pressing Win+R, type 'cmd' and hit enter.
  • change to the directory where you unpacked the files, eg. if you unpacked the files into the folder c:\users\test\documents type
    cd c:\users\test\documents
  • Start it from the commandline:
    MFilesExporter.exe -v "My Vault" -e

Example Output

When you run it over 'My Vault' it produces this CSV File

The following screenshot shows the first few rows of the generated file:

If you find this tool useful or if you found a problem or have a feature suggestion, please feel free to leave a comment. Thank you!

Last updated 11/24/2015 05:26:54
blog comments powered by Disqus
Questions?
Ask Martin