CA Service Management

Expand all | Collapse all

Identify in htmpl list if record is referenced in another table

Jump to Best Answer
  • 1.  Identify in htmpl list if record is referenced in another table

    Posted 11-22-2018 08:49 AM

    Hi, I've been looking for a way to accomplish what I'll explain bellow, but I haven't found anything.

     

    I have two tables defined as follows

    z_tablea

       id

    ...-several z fields--

    z_tableb

       id

       ztablea_id (SREL to z_tablea)

    ...-several z fields--

     

    What I would like to do is, in the list_z_tablea, add a column that displays if in z_tableb there are references to each of the records in z_tablea (or even better, the count of all the references)

     

    Is there a way to achieve this?

     

    Thanks in advance.

     

    Regards.



  • 2.  Re: Identify in htmpl list if record is referenced in another table

    Posted 11-22-2018 09:13 AM

    You need a new attribute. BREL type.

     

    You will then be able to do attribute.length

     

    Have a look at the attribute "group_list" of "cnt" object. This is what you want.

     

     

    Do not forget the advanced attributes to specify the BREL query.

     



  • 3.  Re: Identify in htmpl list if record is referenced in another table

    Posted 11-22-2018 09:15 AM

    Forgot to specify : the new attribute should be in ztablea.

     

    BREL means backward relationship.

     

    Basically the attribute exists only in the object layer and consist in an array of ztableb object that were queried using the query in the advance properties.



  • 4.  Re: Identify in htmpl list if record is referenced in another table

    Posted 11-22-2018 09:20 AM

    Merci Pier, ça a l'air bien! je vais en essayer



  • 5.  Re: Identify in htmpl list if record is referenced in another table

    Posted 11-22-2018 09:22 AM

    Ça fait plaisir!



  • 6.  Re: Identify in htmpl list if record is referenced in another table
    Best Answer

    Posted 11-26-2018 04:04 AM

    For some reason the syntax ztablea_id DYNAMIC { DOMSET... } doesn't work (odd since it is indeed the one used for the group_list field), but looking to the installations' maj files I was able to find another syntax that does work.

     

    ztablea_id DYNAMIC { LREL ztablea_id; }

    And in the list:

    <PDM_MACRO name=lsCol hdr="Test" attr="test_list" display_attr="length" startrow="no">

     

    Thanks pier-olivier.tremblay for pointing in the right direction