Get Entity fields from dynamic attribute

Hi everyone!
At my project I found the next trouble: I added dynamic attribute which attribute is entity and I want to get some its fields to show it at screen
Could you tell can I do that or no?

I will be grateful for every your answer

here the test projectproject.zip (79.1 KB)

Hi.

Dynamic attributes display on a screen as a simple field. For String , Double , Entity , Fixed-point number and Integer data types the checkbox Lookup field is available. If this checkbox is set, the user can select the attribute value from the drop-down list. The list of valid values can be configured on the Calculated values and options tab. For the Entity data type Where and Join clauses are configured.

Regards,
Natalia.

@firstova , Thank you very much, but I have one more question: what should I chose at field Attribute depends on and it belongs to Entity, which we add to dynamic attribute or to the dynamic attribute itself?

Because I have not anything to chose

In the Attribute depends on field, you can specify which dynamic attributes the current attribute depends on.

It means I can add empty textfields to dynamic attribute panel and add them as dependent?

No, it means, that dynamic attributes from the same category could be dependent on each other.

I can add attribute with type Entity and also add some string fields which I make dependent on entity attribute, doesn’t it? or I can only calculate some values?

here project with init scripts
testProj.zip (83.1 KB)

You can get any attribute value from a dynamic attribute entity field in the attribute calculation script. Please note that you cannot access attributes that are not included in _minimal view, so you need to reload dynamic attribute entity using a proper view.

So, for your example calculation script for ‘ShowNumber’ integer attribute may look like this:

return (com.haulmont.cuba.core.global.AppBeans.get('cuba_DataManager')
        .reload(entity.getValue('+ShowNumberPart'), '_local')).getValue('number')
1 Like