CA Service Management

Expand all | Collapse all

Sortable custom field

  • 1.  Sortable custom field

    Posted 09-13-2017 07:15 AM

    We have a custom table. It has a date filed and an id field (default field). I want to it can be sortable date field firstly and if date field is empty it can be sortable id field on list_<customobject>.htmpl file. How can we this?



  • 2.  Re: Sortable custom field

    Posted 09-13-2017 07:49 AM

    Hi,

    you can define multiple sorting attributes in this way:

    // file name: z_custom.maj
    // where "z_custom" is a table name and "some_date" and "id" are sortable attributes
    OBJECT z_custom {
         FACTORY {
              STANDARD_LISTS {
                   SORT_BY "some_date DESC, id ASC";
                   MLIST OFF;
                   RLIST OFF;
              };
         };
    };

    Regards,

    cdtj



  • 3.  Re: Sortable custom field

    Posted 09-13-2017 08:21 AM

    Hello,

     

    Thanks for your answer. But I tried this. But It is not working. If some_date is null, the system must sort according to id. 



  • 4.  Re: Sortable custom field

    Broadcom Employee
    Posted 09-14-2017 03:59 AM

    Hi Yazici,

     

    After implementing the customizations above, have you recycled the services? The reason I say this is the above customizations seems to apt for your requirement.

     

    Check if you have used the correct customer object name in the above example?



  • 5.  Re: Sortable custom field

    Posted 09-15-2017 09:28 AM

    Hello, 

    You can see the screen shot. Actual Date is ok. But Plan ID is not working. Where is my mistake? 

    I created custom object, stop service, publish schema, start service. And create.maj file and stop service, publish schema, start service.

     

    wsp.mods file 

     

    ////////////////////////////////////////////////////////////////////////
    // Factory: zODYA_OperasyonPlani
    // Description: Fac_Attr_Entry zODYA_OperasyonPlani
    ////////////////////////////////////////////////////////////////////////

    OBJECT zODYA_OperasyonPlani {
    ATTRIBUTES zODYA_OperasyonPlani {
    OpenTicket STRING 50
    {
    ON_NEW DEFAULT "Open Ticket";
    };
    active SREL bool;
    category SREL pcat;
    chg SREL chg;
    cr SREL cr;
    description STRING 5000;
    grup SREL grp;
    kategori SREL pcat;
    zODYA_IslemTarihi DATE;
    zODYA_OperasyonPlani_St SREL zODYA_OperasyonPlani_St;
    last_mod_dt DATE { ON_CI SET NOW; };
    last_mod_by SREL cnt { ON_CI SET USER;
    ON_NEW DEFAULT USER; };
    };

    FACTORY zODYA_OperasyonPlani {
    STANDARD_LISTS {
    MLIST OFF;
    RLIST OFF;
    };
    REL_ATTR id;
    COMMON_NAME OpenTicket;
    };
    };

    MODIFY FACTORY zODYA_OperasyonPlani
    {
    DOMSET MLIST_DYNAMIC "" "" DYNAMIC;

    };


    MODIFY FACTORY zODYA_OperasyonPlani
    {
    DOMSET MLIST_STATIC "" "" STATIC;

    };


    MODIFY FACTORY zODYA_OperasyonPlani
    {
    DOMSET RLIST_DYNAMIC "" "" DYNAMIC;

    };


    MODIFY FACTORY zODYA_OperasyonPlani
    {
    DOMSET RLIST_STATIC "" "" STATIC;

    };

     

    --------------------------------------------------------------------------------------------

    zODYA_OperasyonPlani.maj file

     

    OBJECT zODYA_OperasyonPlani {
    FACTORY {
    STANDARD_LISTS {
    SORT_BY "zODYA_IslemTarihi DESC, id DESC";
    MLIST OFF;
    RLIST OFF;
    };
    };
    };



  • 6.  Re: Sortable custom field

    Posted 09-18-2017 11:37 AM

    Hello.

    Just give the following a try, it might help:

    OBJECT zODYA_OperasyonPlani {
       FACTORY {
          STANDARD_LISTS {
             SORT_BY "zODYA_IslemTarihi=zODYA_IslemTarihi DESC+id DESC, id DESC";
             MLIST OFF;
             RLIST OFF;
          };
       };
    };

     

    Kind regards

    ...........Michael



  • 7.  Re: Sortable custom field

    Posted 09-19-2017 11:20 AM

    Hello Again,

     

    So, It's ok. It's running but if Actual Dates (zODYA_IslemTarihi) are null to all of them, It is not running correctly... Are there any thing to this stuation?

     

    Thanks,



  • 8.  Re: Sortable custom field

    Posted 09-25-2017 04:38 AM

    Hello Again,

     

    So, It's ok. It's running but if Actual Dates (zODYA_IslemTarihi) are null to all of them, It is not running correctly... Are there any thing to this stuation?

     

    Thanks,



  • 9.  Re: Sortable custom field

    Posted 09-25-2017 06:38 AM

    Hi.

    As far as I know, you need to use a separate SQL handling in the order by clause when dealing with null values, someting like

    select ... from ..... order by coalesce( column, -1);

    I am not aware of any way to achieve this with SDM  majic syntax.

    maybe this would be a good product enhancement idea?

    Regards

    ...........Michael