One entity browse for multi lookup return value

Hi,
I have one entity “UDC” which has many attributes such as udctype,udckey. The instance name is udckey. Usually, the return value of this entity browse by lookup is the instance name. But sometimes, I need the return value is udctype instead of instance name udckey. For example, in a lookup field I need to get the value of udckey and in another lookup field I need to get the value of udctype. How can I do it? Thank you.
udc%20entity

Hi,

Where are you going to use udctype? For several visual components, the captionProperty attribute could be the simplest solution.

Hi,
Actually, I have two questions.
1.For example, in a lookup field I need to get the value of udckey and in another lookup field I need to get the value of udctype. But I only have one entity UDC. How can I do it?
2. I associate two attributes in a entity which are related the same entity attribute-UDCKEY. I tried to use two lookup for these two attributes. How can I do it?
TEST%20TYPEUDC%20KEY

@Lookup(type = LookupType.SCREEN, actions = {"lookup"})
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "UDCKEY")
    @NotNull
    protected UDC testtype;

    @Lookup(type = LookupType.SCREEN, actions = {"lookup"})
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "UDCTYPE")
    protected UDC udctype;

    @Lookup(type = LookupType.SCREEN, actions = {"lookup"})
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "UDCKEY")
    protected UDC udckey;

Why not just using captionProperty, if you do need such data model?

@Lookup(type = LookupType.DROPDOWN, actions = {"lookup"})
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "UDCTYPE")
protected UDC udctype;

@Lookup(type = LookupType.DROPDOWN, actions = {"lookup"})
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "UDCKEY")
protected UDC udckey;
<field optionsDatasource="udctypesDs"
       property="udctype"
       captionProperty="udctype"/>
<field optionsDatasource="udckeysDs"
       property="udckey"/>

demo.zip (92.2 KB)

1 Like

Thank you very much. It works with captionproperty.

1 Like