How to use multiple attributes in NamePattern with parent classes

Hi Cuba Team,

I have a issue while using multiple attributes in NamePattern.

I am using name and description as Instance Name in customer table, customer table is the parent table for test1 and test2 tables.

In test1 I want to display name and test2 need to display description.

But while using both name and description as Instance Name in customer table. These two name and description are appearing in name column for test1 table and both name and description are appearing for description column in test2 table.

Can you please say me how to resolve this issue.

Thanks!

Hi,
You can define NamePattern for every individual entity, even if an entity inherited from another.
If you want to display the same entity differently in each table component, then you need to define a generated column for a field corresponding to the specified entity.
Regards,
Gleb

Hi Gleb,

I have gone through the example that you have attached. But here I want to display ‘name’ in name column of test1 table and ‘description’ in description column of test2 table separately.

Thanks!

Hi,

Could you please provide a sample project with more details about particular places where you want to display name and description.

Regards,
Gleb

Hi Gleb,
Please find the below attached sample project and snapshots.
In snapshots you can find test1 and test2 tables. In Test1 table I want to display only ‘John’ as Customer Name and in Test2 table I want to display only ‘Sales Person’ as Customer Description.
Thanks!!

Customer

Test1

Test2

Unfortunately, I don’t see a project. Could you please reattach it?

Regards,
Gleb

https://github.com/sushmareddy1851/sample

Hi,

Please find the below link

https://github.com/sushmareddy1851/sample

Thanks!

Hi Gleb,

Could you see the project now.

Thanks!

Hi,

Sorry for a long reply. I’ve taken a look at your project and as I advised before, you need to use generated columns to display proper information.

For example, inside test1-browse you can add a generator for the name_customer column:

<column id="name_customer"
                        caption="Customer Name"
                        generator="customerName"/>

and its realization:

public Component customerName(Test1 entity) {
   return new Table.PlainTextCell(entity.getName_customer().getName());
}

The same for the test2-browse.
I’ve reattached your project with fixes.

Regards,
Gleb

sample-customer.zip (43.0K)

Thank You!! Gleb

How can we set the same in editor screen?

You can use options map for correlation of entities with display names.