Murali,

Better to create a view-entity to join the two tables, so that you have all
info you required.


On Sun, Jan 26, 2014 at 2:58 AM, Christian Carlow <
[email protected]> wrote:

> Hey Murali,
>
> In that case, the <display-entity> entity-name should be set to "Person"
> instead of "HelloPerson" since it's the entity containing the gender field.
>
> Something like:
>
>
> <field use-when="helloPersonHobby!=null @and guestId!=null"
> name="gender" ><display-entity
> entity-name="Person" description="${gender}"></
> display-entity></field>*
>
>
>
>
> On 01/25/2014 12:44 PM, Murali Shankar Gopalakrishnan wrote:
>
>> The Gender is a Field in the "Person" Entity.
>>
>> The HelloPersonHobby Entity just has two fields 1) PersonId 2) HobbyId.
>> Both FKs the first one to HelloPerson Entity (that contains the field
>> gender) and the second field FK to a entity called Hobby.
>>
>> So , in this context, where, I need to extract the data from a related
>> entity (master table) and show multiple fields of the related table,
>> during
>> Create/Update of a transaction table is what I am trying to do.
>>
>> Appreciate some thoughts on how this can be modelled in a form widget. I
>> am
>> sure this is a common need, and I am also sure there should be some way.
>>
>> Thank you.
>>
>> Cheers
>> murali
>>
>>
>>
>> On Sat, Jan 25, 2014 at 11:45 PM, Christian Carlow <
>> [email protected]> wrote:
>>
>>  Hey Murali,
>>>
>>> If gender is defined in HelloPersonHobby then as stated in my first
>>> response, there is no need for <display-entity> so <display> should
>>> replace
>>> it.  Also, the name of the field should be changed to gender instead of
>>> guestId.
>>>
>>>
>>> On 01/25/2014 11:54 AM, Murali Shankar Gopalakrishnan wrote:
>>>
>>>  Here goes the Form Widget Christian. Have made the couple of elements in
>>>> question in Bold.
>>>>
>>>>       <form name="EditPersonHobby" type="single"
>>>> target="updatePersonhobby"
>>>> title="Edit Person Hobby" default-map-name="helloPersonHobby"
>>>> default-entity-name="HelloPersonHobby">
>>>>             <alt-target use-when="helloPersonHobby==null"
>>>> target="createPersonhobby?gender=${gender}"/>
>>>>           <!--  <auto-fields-service service-name="updatePersonHobby"/>
>>>>   -->
>>>>
>>>>           <field use-when="helloPersonHobby!=null" name="guestHobbyId"
>>>> title="${uiLabelMap.PersonHobbyId}"
>>>> tooltip="${uiLabelMap.CommonNotModifRecreat}"><display/></field>
>>>>           <field use-when="helloPersonHobby==null @and
>>>> guestHobbyId==null"
>>>> name="guestHobbyId" title="${uiLabelMap.PersonId}"><ignored/></field>
>>>>           <field use-when="helloPersonHobby==null @and
>>>> guestHobbyId!=null"
>>>> name="guestHobbyId" title="${uiLabelMap.PersonHobbyId}"><display
>>>> description="${uiLabelMap.CommonCannotBeFound}: [${guestHobbyId}]"
>>>> also-hidden="false"/></field>
>>>>           <field use-when="helloPersonHobby==null @and guestId==null"
>>>> name="guestId" title="${uiLabelMap.PersonName}">
>>>>           <drop-down>
>>>> <entity-options entity-name="HelloPerson" description="${firstName}" />
>>>> </drop-down>
>>>> </field>
>>>> * <field use-when="helloPersonHobby!=null @and guestId!=null"
>>>>
>>>> name="guestId" entry-name="gender"><display-entity
>>>> entity-name="HelloPerson" description="${gender}"></
>>>> display-entity></field>*
>>>> * <field use-when="helloPersonHobby!=null @and guestId!=null"
>>>>
>>>> name="guestId" entry-name="guestId"><display-entity
>>>> entity-name="HelloPerson"
>>>> description="${firstName}"></display-entity></field>*
>>>>
>>>>
>>>>           <field name="hobbyId">
>>>> <drop-down>
>>>> <entity-options entity-name="HelloHobby" description="${description}" />
>>>> </drop-down>
>>>> </field>
>>>>           <field name="submitButton" use-when="helloPersonHobby==null"
>>>> title="${uiLabelMap.CommonCreate}"><submit
>>>> button-type="button"/></field>
>>>>           <field name="submitButton" use-when="helloPersonHobby!=null"
>>>> title="${uiLabelMap.CommonUpdate}"><submit
>>>> button-type="button"/></field>
>>>>       </form>
>>>>
>>>>
>>>> On Sat, Jan 25, 2014 at 10:33 PM, Christian Carlow <
>>>> [email protected]> wrote:
>>>>
>>>>   Sorry Murali,
>>>>
>>>>> I think I'm mistaken.  Please post the entire form widget code.
>>>>>
>>>>>
>>>>> On 01/25/2014 10:30 AM, Christian Carlow wrote:
>>>>>
>>>>>   Hey Murali,
>>>>>
>>>>>> Seems like this is the problem:
>>>>>>
>>>>>> <field  name="guestId"  name="gender"
>>>>>> entry-name="guestId"><display-entity
>>>>>>
>>>>>> I think the form widget <display-entity> element is only supposed to
>>>>>> be
>>>>>> used for fields that are PKs.  Since gender is not a PK field, an
>>>>>> entity
>>>>>> cannot be found.  If gender is defined in the entity that is being
>>>>>> used
>>>>>> by
>>>>>> the form, then replacing <display-entity> with <display> seems like it
>>>>>> would resolve the problem by correctly displaying the gender of the
>>>>>> person.
>>>>>>
>>>>>> On 01/25/2014 10:14 AM, Murali Shankar Gopalakrishnan wrote:
>>>>>>
>>>>>>   <field  name="guestId"  name="gender"
>>>>>>
>>>>>>> entry-name="guestId"><display-entity
>>>>>>>
>>>>>>>
>>>>>>>
>

Reply via email to