Menu

Question on Tab baseCondition

2017-03-16
2017-03-16
  • Brian Cheong

    Brian Cheong - 2017-03-16

    Hi all,

    I want the system to show only certain location when user login. So I am using @Tab(name="FilterLocation", baseCondition="from DUN d, where d.dunCode = 'N8'") to show only the location with N8 but I think I am missing something for it to work. DUN is the entity and dunCode is the property. Please guide me. Thanks in advance.

    Brian

     
  • swapnil autade

    swapnil autade - 2017-03-20

    In basecondition just add
    @Tab(name="FilterLocation", baseCondition="${dunCode}='N8'")

    instead
    @Tab(name="FilterLocation", baseCondition="from DUN d, where d.dunCode = 'N8'")

     
  • Brian Cheong

    Brian Cheong - 2017-03-29

    Hi Autade,

    In the database table, I have cod_key for MOBILECC and MOBILEAC, both cod_key have own cod_value. For example, cod_value for MOBILECC is "60" and for MOBILEAC is "10 to 19". How can I display only the cod_value for MOBILECC at the property? I tried with

    @Tab(name="MOBILECC", baseCondition="${COD_KEY}='MOBILECC'")
    @Entity
    public class Mobilecc {
    
    ...
    
    }
    

    but it is not working. The description list displays all cod_value instead of cod_value for MOBILECC only.

    Thanks.

    Brian

     

    Last edit: Brian Cheong 2017-03-29
  • Brian Cheong

    Brian Cheong - 2017-03-29

    I found the solution of doing it by having a condition for the descriptionslist. Thanks,

     
  • Brian Cheong

    Brian Cheong - 2017-04-06

    Hi Autade,

    I want to show the list of data for education only, but all data is shown from what I have in the database table. Which part I did wrongly? I am currently trying with:

    @Table(name="activity_list")
    @Tab(name="EducationOnly", baseCondition="${formType} = '5'")
    public class Education {
    
    ...
    
     @ManyToOne
     @NoCreate
     @NoModify
     @ReadOnly
     @DefaultValueCalculator(value=IntegerCalculator.class, properties=
     @PropertyValue(name="value", value="5"))
     @JoinColumn(name="TYPE_ID", nullable = false)
     @DescriptionsList(descriptionProperties="typeDescription")
     private Type formType;
    

    Please note that in my Education property, I have a @DescriptionsList for the formType property. Please guide me.

    Thanks.

    Brian

     

    Last edit: Brian Cheong 2017-04-06
  • Javier Paniza

    Javier Paniza - 2017-04-10

    Hi Brian,

    Try:

    @Tab(name="EducationOnly", baseCondition="${formType.id} = '5'")
    

    If id the the @Id Type, and it is String.

    --------- 
    Help others in this forum as I help you.

     
  • Brian Cheong

    Brian Cheong - 2017-04-11

    Hi Javier,

    I have tried with

    @Tab(name="EducationOnly", baseCondition="${formType.typeId} = '5'")
    

    but it is not working. The typeId is the property with @Id for the entity Type.

    Thanks

    Brian

     

    Last edit: Brian Cheong 2017-04-11
  • Javier Paniza

    Javier Paniza - 2017-04-13

    Hi Brian,

    Maybe you're not using the EducationOnly tab. Try to put show_sql to true in persistence.xml and have a look at the generated SQLs. It can give you some clue.


    Help others in this forum as I help you.

     
  • Javier Paniza

    Javier Paniza - 2017-04-13

    Hi Brian,

    Maybe you're not using the EducationOnly tab. Try to put show_sql to true in persistence.xml and have a look at the generated SQLs. It can give you some clue.


    Help others in this forum as I help you.

     
  • Javier Paniza

    Javier Paniza - 2017-04-13

    Hi Brian,

    Maybe you're not using the EducationOnly tab. Try to put show_sql to true in persistence.xml and have a look at the generated SQLs. It can give you some clue.


    Help others in this forum as I help you.

     
  • Brian Cheong

    Brian Cheong - 2017-04-17

    Hi Javier,

    The following is the stacktrace of the code:

    Hibernate: select folder0_.id as id1_3_, folder0_.icon as icon2_3_, folder0_.name as name3_3_, folder0_.orderInFolder as orderInF4_3_, folder0_.parent_id as parent_i5_3_ from OXFOLDERS folder0_ where folder0_.parent_id is null order by folder0_.orderInFolder
    Hibernate: select modules0_.folder_id as folder_i6_3_0_, modules0_.name as name1_4_0_, modules0_.application as applicat2_4_0_, modules0_.name as name1_4_1_, modules0_.application as applicat2_4_1_, modules0_.folder_id as folder_i6_4_1_, modules0_.hidden as hidden3_4_1_, modules0_.orderInFolder as orderInF4_4_1_, modules0_.unrestricted as unrestri5_4_1_ from OXMODULES modules0_ where modules0_.folder_id=? order by modules0_.orderInFolder
    Hibernate: select modules0_.folder_id as folder_i6_3_0_, modules0_.name as name1_4_0_, modules0_.application as applicat2_4_0_, modules0_.name as name1_4_1_, modules0_.application as applicat2_4_1_, modules0_.folder_id as folder_i6_4_1_, modules0_.hidden as hidden3_4_1_, modules0_.orderInFolder as orderInF4_4_1_, modules0_.unrestricted as unrestri5_4_1_ from OXMODULES modules0_ where modules0_.folder_id=? order by modules0_.orderInFolder
    Hibernate: select module0_.name as name1_4_, module0_.application as applicat2_4_, module0_.folder_id as folder_i6_4_, module0_.hidden as hidden3_4_, module0_.orderInFolder as orderInF4_4_, module0_.unrestricted as unrestri5_4_ from OXMODULES module0_ where module0_.folder_id is null order by module0_.application asc, module0_.name asc
    Apr 17, 2017 8:46:35 AM org.openxava.tab.impl.JPATabProvider nextBlock
    FINE: [JPATabProvider.nextBlock] Executing SELECT e.aka_id, e.title, e.description, e.dateStart, e.dateEnd, e.estimatedCost, e.attendance, e.remark from EducationOnly e with arguments 
    Hibernate: select educationo0_.AKA_ID as col_0_0_, educationo0_.AKA_TITLE as col_1_0_, educationo0_.AKA_DESC as col_2_0_, educationo0_.AKA_DATE_START as col_3_0_, educationo0_.AKA_DATE_END as col_4_0_, educationo0_.AKA_EST_COST as col_5_0_, educationo0_.AKA_ATTENDANCE as col_6_0_, educationo0_.AKA_REMARK as col_7_0_ from basc.t_asc_kpi_activity educationo0_ limit ?
    Apr 17, 2017 8:46:35 AM org.openxava.tab.impl.TableModelBean getRow
    FINE: nextChunk=3
    Hibernate: select count(*) as col_0_0_ from basc.t_asc_kpi_activity educationo0_
    Apr 17, 2017 8:46:35 AM org.directwebremoting.util.CommonsLoggingOutput info
    INFO: Exec: Module.getStrokeActions()
    

    It seems like the sql still select ALL eventhough I have prompted it to select certain id only. What should I do with it?

    Thanks.

    Brian

     
  • Javier Paniza

    Javier Paniza - 2017-04-19

    Hi Brian,

    You're right the condition is not shown, surely you're not using the EducationOnly tab in that module. Could you put here the module definition from application.xml?


    Help others in this forum as I help you.

     
  • Brian Cheong

    Brian Cheong - 2017-04-20

    Hi Javier,

    This is the module that I have in application.xml:

    <module name="Education">
            <model name="Education"/>
            <controller name="Education"/>
            <controller name="DataAccessControl"/>   //for filtering data
        </module>
    

    Thanks.

    Brian

     
  • Javier Paniza

    Javier Paniza - 2017-04-25

    Hi Brian,

    Try this for your module definition:

    <module name="Education">
            <model name="Education"/>
            <tab name="EducationOnly"/> // To choose the tab for this module
            <controller name="Education"/>
            <controller name="DataAccessControl"/>   
    </module>
    

    --------- 
    Help others in this forum as I help you.

     

Log in to post a comment.