IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Hide table when empty

  • 1.  Hide table when empty

    Posted Mon May 02, 2016 10:17 AM

    Hi,

    I have an Async table that gets created even when there is no data in it.
    It looks odd and i want the table to appear only when the content is there !
    Is there a way to do it ?

    many thanks !

    br,
    Kiran


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 2.  RE: Hide table when empty

    Posted Mon May 02, 2016 11:48 AM

    Hi Kiran,

    is there DataProvider attached to the table?

    If so, try to get its length and check the visibility as “length>0”.

    Regards,
    Holger


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 3.  RE: Hide table when empty

    Posted Mon May 02, 2016 12:17 PM

    Hi Holger,

    I’m getting the data from a web service in Manged Bean. I haven’t created any content provider and im not sure how and where to check the visibility.

    Can you elaborate.

    many thanks in advance.

    br,
    Kiran


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 4.  RE: Hide table when empty

    Posted Mon May 02, 2016 03:14 PM

    Hi Kiran,

    there is a property on the table which controls if it is visible or not.
    If not, place the table inside a HideablePanel and set its status accordingly.

    But this can be replaced by a boolean expression, in this case the number of rows of data being present in the table.

    When the WS returns no data, expression should return false and when the WS returns some data the expression should return true.

    Regards,
    Holger


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 5.  RE: Hide table when empty

    Posted Mon May 02, 2016 03:26 PM

    Its the ‘Rendered’ property that is on every control. You can set the set the value to an expression that resolves to true or false. You should be able to construct an expression that evaluates whether the data bound to the table is empty or not.


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 6.  RE: Hide table when empty

    Posted Tue May 03, 2016 09:24 AM

    Hi Eric,

    thanks for precising the answer.

    Regards,
    Holger


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 7.  RE: Hide table when empty

    Posted Wed May 04, 2016 04:06 AM

    Hi Guys,

    Thanks for your feed back.

    I tried to put a flag in the webservice call that give false if the table is empty and true when data is present.
    But still the table disappears after i click refresh.

    I tried using the rendered property both on hideable pnel and table the end result is the same.
    I also used the boolean data type for setting the rendered property but dint work.

    Is there a specific way to do it ?

    br,
    Kiran
    snap (3).png


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 8.  RE: Hide table when empty

    Posted Wed May 04, 2016 05:11 AM

    Do not use both hideable panel and table rendered property at same time. Just stick to table Rendered property. Make sure your flag comes as boolean. If it is string then you can change your EL to something like below:
    #{sample.webservice.result.flag == “true”}


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 9.  RE: Hide table when empty

    Posted Wed May 04, 2016 01:27 PM

    FYI: There is a simpler solution to tell if the table data is empty without modifying your web service at all.

    Just take the expression that is bound to the ‘Value’ property of the table control.

    For example, if the value expression of the table control is bound to this:

    #{YourDefaultViewView.tableContent}

    If that expression resolves to an Array or List of rows, then you can simply use the “not empty” operator of the expression language to check if that list or array is empty.

    For example, set the ‘Rendered’ property to an expression that is something like this:

    #{not empty YourDefaultViewView.tableContent}

    Or if the value expression of the table control resolves to a table content provider, then you can simply use the provided getRowCount() method of the table content provider model to get the number of rows and check if it is greater than zero.

    For example, set the ‘Rendered’ property to an expression that is something like this:

    #{YourDefaultViewView.tableProvider.rowCount > 0}

    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 10.  RE: Hide table when empty

    Posted Thu May 05, 2016 04:36 AM

    Hey Eric,

    That’s even simpler. Too bad i already made the changes by modifying the services in the IS.
    No doubt this would be easier to implement without making any changes to the service.

    thanks for your response i will surely keep that in mind and use it later.

    br,
    Kiran


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 11.  RE: Hide table when empty

    Posted Thu May 05, 2016 04:51 AM

    I did that already but was doing it in a wrong way. I had to put my table inside the Hideable Panel and then use the rendered property of the table to display it when table has data and hide when it’s empty. I used the boolean flag.

    And yes your way also works if i’m not using boolen flag.

    Thanks for your suggestion.

    br,
    Kiran


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine