How to add logic to manipulate data before users can see it?


#1

Hi community, I have several visualizations running on postgresql and the chartfactor data app is looking great. However, I need to add logic so that some users only see a portion of the data. I could accomplish this through table views but I was wondering if you could provide me with another option using chartfactor?


#2

Hi @free.dev, as I understand what you are needing is to manipulate the data before it is shown to the users, that is to add filters depending on the role of the user or something similar. Chartfactor provides a solution for these cases, which is a downloadable project called ChartFactor Node that you can clone from Aktiun’s GitHub repository.

As it says in the project’s description by running data providers on the server-side you can apply custom logic such as filters before executing the actual queries on the data engine.

Inside the ./etc folder you will find two files, metadataConstraints.json y staticFilters.json, where you can add the necessary restrictions and filters before returning the data, but you can also add some custom logic into the endpoints if necessary.

Hope this can help you.


#3

@juan.dominguez, that solution that you propose is very good, I have been analyzing it and I think it can serve my purpose, I’m going to delve deeper into ChartFactor Node and I will be asking you any questions.

Thanks…