cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to add a new column in the backoffice hybris, but filter for only object that is true

Former Member
0 Kudos
1,142

in the Customer Review Object, I created a relationship with a table called Like Review. Well, I would like comments received likes whether it was useful or not

        <relation code="Review2User" localized="false"
               generate="true" autocreate="true">
         <sourceElement qualifier="likeReview" type="LikeReview"
                        cardinality="many" >
         </sourceElement>
         <targetElement qualifier="customerReview" type="CustomerReview"
                        cardinality="one">
         </targetElement>
     </relation>

    <typegroup name="LikeReview">
         <itemtype code="LikeReview" autocreate="true" generate="true">
             <deployment table="likeReview" typecode="15088"/>
 
             <attributes>
                 <attribute type="Customer" qualifier="customer" >
                     <modifiers optional="false" unique="true"/>
                     <persistence type="property"/>
                 </attribute>
                 <attribute type="CustomerReview" qualifier="review" >
                     <modifiers optional="false" unique="true"/>
                     <persistence type="property"/>
                 </attribute>
                 <attribute qualifier="isLike" type="java.lang.Boolean">
                     <defaultvalue>Boolean.FALSE</defaultvalue>
                     <persistence type="property"/>
                 </attribute>
             </attributes>
         </itemtype>
     </typegroup>

My doubt is about, as I add a new column in the backoffice, but that this column, is only an account of how many votes the comment had

example:

Comment x had 10 useful votes.

so in the backoffice the table would look like this:

comment | useful votes x | 10

when I click on 10, it will load a list of users who voted as a useful comment

my doubt is referent how to group in the column comments that received votes as useful and how to load the list of users who voted as positive

Accepted Solutions (1)

Accepted Solutions (1)

sduvvuri
Explorer
0 Kudos

Hello Felipe,

You can have something like below:

  • comments as a dynamic attribute for LikeReview model. This gets calculated based on the number of customers voted.

So in this case if a1, b1 and c1 are the customers who voted the comment as useful then for comments you can see the value as 3 (which gets calculated dynamically by its handler). In Dynamic handler you can get the number of all the customer models who had voted for the comment.

Hope it is helpful to you.

Thanks, .

Former Member
0 Kudos

, Many thanks for the suggestion.

I had in how to solve using a dynamic attribute

I found that I could do this by simply overwriting some backoffice xml or some class getting the qualifier value

Like this. for me to create a list of only clients who voted as true, should I use a dynamic attribute?

Answers (0)