Export is not working in my smart collection

Feature(s) impacted

Export csv action in my smart collection

Observed behavior

I export csv but I have the following message →
Export failed: Unexpected error. Please check your Admin API server logs.
And nothing is printed in the logs except

GET /forest/datastudioCategoryFeaturesData.csv?fields%5BdatastudioCategoryFeaturesData%5D=id%2CcategoryName%2CproductId%2CsoftwareName%2CfeatureName%2CcategoryId%2CfeatureId&page%5Bnumber%5D=1&page%5Bsize%5D=15&filters=%7B%22field%22%3A%22categoryName%22%2C%22operator%22%3A%22equal%22%2C%22value%22%3A%22sales-tracking-software%22%7D&sort=-id&filename=datastudio+category+features+data&header=id%2Ccategory+name%2Cproduct+id%2Csoftware+name%2Cfeature+name%2Ccategory+id%2Cfeature+id&sessionToken=&timezone=Europe%2FZurich 404 180 - 6.321 ms

Expected behavior

Download a csv of my smart collection

Failure Logs

GET /forest/datastudioCategoryFeaturesData.csv?fields%5BdatastudioCategoryFeaturesData%5D=id%2CcategoryName%2CproductId%2CsoftwareName%2CfeatureName%2CcategoryId%2CfeatureId&page%5Bnumber%5D=1&page%5Bsize%5D=15&filters=%7B%22field%22%3A%22categoryName%22%2C%22operator%22%3A%22equal%22%2C%22value%22%3A%22sales-tracking-software%22%7D&sort=-id&filename=datastudio+category+features+data&header=id%2Ccategory+name%2Cproduct+id%2Csoftware+name%2Cfeature+name%2Ccategory+id%2Cfeature+id&sessionToken=&timezone=Europe%2FZurich 404 180 - 6.321 ms

Hi @Charles_Touret :wave: ,

Can I have your project name, your liana and its version, and the collection name that you are using ?
It could also be useful to have the details of the smart collection.

Best,

Shohan

Hi @shohanr :slightly_smiling_face:
project_name: Uniseed
liana → 8.5.3 - forest-express-sequelize
collection name (it’s a smart collection) → datastudioCategoryFeaturesData

Sorry for the time of answer thanks

Hi @Charles_Touret ,

In the case of a smart collection, you have to implement every route. This is also the case for the route GET “datastudioCategoryFeaturesData.csv”.

  • It could be the issue if you are missing this route.
  • This route will also need to overwrite the filters.

If your smart collection is a simple table, you can overwrite the routes with the default route proposed by forest :

Otherwise it will be up to you to implement the logic of the request :slight_smile:

Have a good day :wave:

Best regards,

Shohan

Ok ! My problem if I want to do that is that I have to create the model link to the smart collection, is there a way to do it easily ?

To answer to that question I would need more information about the smart collection and its source.
But you can try to use the recordsExporter if your smart collection is a simple interface to a table.

Best,

Shohan

Yes amigo but look in the example your provide me, there is in parameter of the method recordsExporter the model, so I need to create the model of my smart collection to use it I think, no ?

Any news on the subject ?

Here is my smart collection code

const { collection } = require('forest-express-sequelize');
const models = require('../models');

collection('datastudioCategoryFeaturesData', {
  isSearchable: true,
  fields: [
    {
        field: 'id',
        type: 'String',
    },
    {
        field: 'softwareName',
        type: 'String',
    }, {
        field: 'categoryId',
        type: 'Number',
    },
    {
        field: 'categoryName',
        type: 'String',
        isFilterable: true,
    },
    {
        field: 'productId',
        type: 'Number',
    },
    {
        field: 'featureId',
        type: 'String',
    },
    {
        field: 'featureName',
        type: 'String',
    }
  ],

});

Hey !

Sorry for the delay.
The export is needed to be overwritten in your smart collection in the route folder not in the forest folder.

Best,

Shohan