Data export is not using the correct column name format

My ops team have a workflow where they want to use the data export that generates a CSV file. Everything works except the exported column names…

In database the column is created_at (snakecase), in sequelize it is converted to createdAt (camelcase), until this point those 2 formats are useful but somehow forestadmin UI wants to convert everything to created at (with space) for aesthetic reasons I suppose. And the only way is to manually change the display name for each column of each table… Is there a real solution to this? Can we decide on the server side once for all for the format?

Hi @whollacsek :wave:, thank you to your feedback.

According to our documentation you can override the export as csv route like this

// Export a list of Users
router.get('/user.csv', permissionMiddlewareCreator.export(), (request, response, next) => {
  request.query.header = request.query.header
    .replace(/ ./g, (header) => header.substr(1).toUpperCase());
    // make here 👆 the change you want on the headers to match your idea
    // here I transform `id,updated at` to `id,updatedAt`
  const recordsExporter = new RecordsExporter(user);
  recordsExporter.streamExport(response, request.query)
    .catch(next);
});

Let me know if it’s help.

1 Like

Hi Arnaud thanks for your reply, it would be great if we can simply disable this behavior as having space in column names is adding complexity in our workflow. I believe other companies would also prefer predictable behavior in this case.

Hi @whollacsek, I am afraid we don’t have such option so far.

The only “no code” solution the platform can offer is the one you suggested in your first message: if you edit the display name of each fields of each tables you need to frequently export, you would have the column names you need for your exports.

It shouldn’t take that long to configure this once (unless you have a lot of tables) even though I agree it would be easier to have a centralised behaviour as you suggested to change this.

Hope it helps.