Summary views or smart views?

Hey guys!

I want to create a custom “view” on a specific collection by adding sections with the Visual builder but the thing is I can’t get all the data I want from other collections even when they are connected So I was wondering if it’s a better solution with smart views?

Thank you in advance for your replies!

Best,

Hi @caid,

In order to be more precise please share your forest model and what you precisely need to do.

From the summary view, when you edit the layout (visual builder) you can add data coming from other collections the summary view.

This can be found under the “related data” section. In the screen below, I am on the album collection and I can display the list of album tracks.

Hey @Sliman_Medini thanks for your fast reply!

Here’s my forest model :

(sorry it’s in french)
This is the refund request collection (it’s for insurance) so I need a section of the beneficiary (a some other sections) info who requested for the refund, I have the beneficiary id but I can’t get it in the related data section (and I’m not really feeling confident to change its relation, maybe I have to do it even with a smart view?)

Thanks!

Hello @caid,

Could you tell me what is the relation between the refund request collection and the beneficiary collection?
What would be great is to have the sql definition and the ORM generated part.
Are you on node.js or rails?

Let me know :slight_smile:

Hey @Guillaume_Cisco !

So sorry for the lack of information I gave :confused:

The relation between the refundRequest and beneficiary is like that :

this.models.beneficiary.hasOne(this.models.refundRequest, {
            foreignKey: "fk_beneficiaryId"
        });

Here’s my stack :

  • NodeJS
  • PostgresSQL
  • ORM : sequelize

Thanks a lot!!!

Thank you :slight_smile:

Could you give me more details please.
The this.models.refundRequest association too.
Did you create yourself the association or there were auto generated by the lumber-cli?

Could you also give me a psql dump declaration of the tables in order for me to try reproducing your issue and bring you a solution.

Thank you,

Thanks for your fast replies @Guillaume_Cisco !!!

What information can I give you about the association?
The association was created by ourself, before we did our ForestAdmin integration.
Here’s the compressed file with all the models declaration that have a association with the refundRequest collection.models.gz (1.9 KB)

Thank you!

Thank you @caid, I will look at your definitions.
Would that be also possible to have the psql dump declaration table too? :pray:

@Guillaume_Cisco is it possible to send it to you privatly?
There are a lot of confidential data :confused:

For sure, but all I need is the declaration of the sql table, I don’t need any data.
You could provide me something like:

create table if not exists users
(
	id serial not null
		constraint users_pk
			primary key,
	name varchar not null
);

Would that be ok for you, or do you prefer to send it privately too?

Hey @Guillaume_Cisco

Sorry for my late reply, yes I prefer to send it to you privatly :confused: should I do it by email or directly through the message next to your tag?

Thanks a lot!

Hi again @caid :wave: if I understand correctly I think you could achieve your goal with some smart fields by following this Create and manage Smart Fields - Documentation.
You can do something like this

{
    field: 'beneficiaire name',
    type: 'String',
    get: (async refundRequest) => {
      const bene = await beneModel.findByPk(refundRequest.beneId);
      return  bene.name;
    }
}

And then display this smart filed inside your custom view.
Let me know if that help.

Hey @Arnaud_Moncel,

I found, we used the get method in smart fields and could retrieve the data that we wanted.
Thanks a lot !

Best,

1 Like