Error with lookup picker field with objects at Create/Edit forms

Hi, how do you do?

Anyone who can help me with some problems I have when customizing the creation and editing views of an Entity?

How you can see in this form there is the field ID_TEMA. and I have a lookup picker field component, and it works fine, thanks to the demos that Cuba has on GitHub, but the fields ID_CRITERIO and ID_QUESTIONARIO should also be selected with a lookup picker field, but I couldn’t.

I have noticed that in the code of this entity it does not mention the CRITERIO and CUESTIONARIO classes indeed call a third class called CompKey which is the class that is responsible for calling both IDs.

As you can see at screen file we have the call of id.idCriterio and id.idCuestionario

When we see the CompKey class it is observed that it makes mention of ID_CRITERIO and ID_CUESTIONARIO but as variables of type Integer, but this does not help me since it must be possible to select the Criterio and the Cuestionario by name and that the ID is saved as with the variable Subject .

If someone can give me any suggestion or recommendation to be able to fulfill my objective, I would be very grateful.

Thank you very much and greetings.

Hi @brandonriveragodines.
The solution to your problem on the stackoverflow .

  1. Add MapsId attributes to TrdCuestCriterios entity.
@JoinColumn(name = "ID_CRITERIO")
@ManyToOne(optional = false)
private YouEntityForCriterio criterio;

@JoinColumn(name = "ID_CUESTIONARIO")
@ManyToOne(optional = false)
private YouEntityForCuestionario cuestionario;  

YouEntityForCriterio and YouEntityForCuestionario are the entities associated with id attributes from empedded entity TrdCuestCriteriosCompKey

  1. Generate database scripts for foreign key of TRD_CUEST_CRITERIOS table

  2. Add a new property in view associated with the editor screen for TrdCuestCriterios entity

     <view extends="_local">
         <property name="criterio" view="_minimal"/>
         <property name="cuestionario" view="_minimal"/>
  3. In the screen editor remove textField components with id idIdCriterioField and idIdCuestionarioField

  4. Add pickerField for criterio and cuestionario attributes

     <pickerField id="criterioField" property="criterio"/>
     <pickerField id="cuestionarioField" property="cuestionario"/>

See links:

1 Like

Thank you so much, it works now!