webMethods

webMethods

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

table row selection

  • 1.  table row selection

    Posted Tue April 25, 2017 10:47 AM

    Hi Team,

    I am new to CAF. I am working on a task, where i need to display some result in Table format. And this result have multiple columns. till this i am able to display. here to this table i need to add ‘CheckBox’ and need to select some columns and this columns data need to passed to another WS as input.

    please let me know procedure for this.


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


  • 2.  RE: table row selection

    Posted Tue April 25, 2017 03:21 PM

    You can do the row selection by adding a “Select Row Checkbox” control to one of the columns of your table control.

    Then in your server side action handler for some command control you can get the row objects backing the selected rows with something like this:

    
    //TODO: get a reference to the table provider
    ISelectableTableContentProvider tableProvider = getTableRowProvider();
    
    List<Object> selectedRowObjects = new ArrayList<Object>();
    Collection<String> rowSelectedIds = tableProvider.getRowSelectedIds();
    String originalRowId = tableProvider.getRowId();
    try {
    //loop to position the table provider on each
    // selected row
    for (String rowId : rowSelectedIds) {
    tableProvider.setRowById(rowId);
    Object currentRow = tableProvider.getCurrentRow();
    selectedRowObjects.add(currentRow);
    }
    } finally {
    //put it back
    tableProvider.setRowById(originalRowId);
    }
    
    //TODO: do something with your selectedRowObjects list here		

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


  • 3.  RE: table row selection

    Posted Wed April 26, 2017 07:48 AM

    Hi Eric,

    Thanks for quick replay.

    When i am trying to place ‘select row checkbox’ , i am getting error as given in attached screen shot.
    And can u please elaborate more how to use Java code which you given(I am guessing i need to write this is action place and need to map this action to submit button). please correct if i am wrong. And also please let me know how to map this data to next WS input.

    Thanks in Advance.


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


  • 4.  RE: table row selection

    Posted Wed April 26, 2017 08:38 AM

    Hi Naresh,

    1. Please find attached short document with screenshots to know how to create table content provider.
    2. Yes, you need to write this in the action method and need to bind this action to an async/sync command (button, icon etc…)
    3. While you have the details of selected row with you (from the code Eric provided), you can access the parameters of webservice connector by calling “getParameters()” method from its Managed Bean and then calling the setter methods inside it will help you to set the inputs of webservice.

    Creating Updatable Table Content Provider.docx (126 KB)


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


  • 5.  RE: table row selection

    Posted Wed April 26, 2017 11:12 AM

    Hi Prasad Pokala,

    thank you for clear explanation. I am unable to select columns now.
    But when i am planning to Map this service Output( selectedRowObjects ) to my next WS input , i am getting error as given in attachment.

    i am attaching entire action code also here. please check and correct me if anything wrong.

    thanks in Advance.
    Action-code.docx (13.4 KB)


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


  • 6.  RE: table row selection

    Posted Wed April 26, 2017 11:18 AM

    Naresh, you are trying to set whole List as input to your webservice connector. List will have your entire selected rows. You have to iterate on this list and then collect the values you want out of those rows and then pass in to webservice connector


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


  • 7.  RE: table row selection

    Posted Wed April 26, 2017 12:14 PM

    Hi Prasad Pokala,

    i tried to loop over as given in below code.

    String rowvalue=“”;
    for(int i=0;i<selectedRowObjects.size();i++)
    {
    String currRowValue=(String )selectedRowObjects.get(i);
    rowvalue=currRowValue[i];

    	    	getResubmitProcessStep().getParameters().getResubmitProcessStep().getResubmitProcessStep().setStepErrorsFrmProcess(rowvalue);
    }
    

    but still getting error as attached earlier.

    i am using wm-9.9 version.

    can you please provide some sample code for this mapping. that will be very helpfull for me.


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


  • 8.  RE: table row selection

    Posted Wed April 26, 2017 01:20 PM

    First of all, you should know what is the input type that your webservice connector accepts. Otherwise you will keep getting the cast exceptions.

    Assuming that your “setStepErrorsFrmProcess” accepts a string array of stepIds, below is the sample code:

    String selectedStepIdsFromTable = new String[selectedRowObjects.size()];
    
    // Iterate through selected rows and get the STEP ID (or any other value you are interested in)
    for(int i=0;i<selectedRowObjects.size();i++) 
    { 
    selectedStepIdsFromTable[i] = ((<TYPE CAST TO ITS CLASS>)selectedRowObjects.get(i)).getStepId(); 
    } 
    
    // Invoke your webservice
    getResubmitProcessStep().getParameters().getResubmitProcessStep().getResubmitProcessStep().setStepErrorsFrmProcess(selectedStepIdsFromTable); 

    Above code is assuming your “setStepErrorsFrmProcess” accepts string as input. If it accepts some other type then you need to prepare your inputs according and then pass into it.


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


  • 9.  RE: table row selection

    Posted Thu April 27, 2017 11:36 AM

    Hi Prasad,

    i am facing below issues when i am working on your solution :frowning:
    selectedStepIdsFromTable[i] = (()selectedRowObjects.get(i)).getStepId();
    }

    From above line my coloumn names are not populating after get(i) method.

    And when i am logging selectedRowObjects.size()[b] it returning properly with selected rows count.

    But when i am trying to log ‘selectedStepIdsFromTable[i]’ it returning NULL.


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


  • 10.  RE: table row selection

    Posted Thu April 27, 2017 11:39 AM

    Share me your CAF application project pls


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


  • 11.  RE: table row selection

    Posted Thu April 27, 2017 11:46 AM


  • 12.  RE: table row selection

    Posted Thu April 27, 2017 12:00 PM

    Your project is corrupted. I do not see any “stepErrorsFrmProcess” under “retriveFailedTransactionsResponse”.
    Capture.PNG


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


  • 13.  RE: table row selection

    Posted Tue May 02, 2017 07:21 AM

    Hi Prasad Pokala,

    Sorry for delayed response. i am busy with another activity. here i am attaching new .zip file related to my project.

    in CAF screen i added two buttons with different actions.

    On ‘another’ button i used logic which you given above. Still facing same issue :(.

    On ‘Resubmit’ button i used another logic using ‘List selected = stepErrorsFrmProcessProvider.getSelectedRows();’ method. here also i am facing unknown issue. Please check and help me on this if you get free time :).

    BulkResubmit.zip (222 KB)


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


  • 14.  RE: table row selection

    Posted Tue May 02, 2017 07:35 AM

    Sure. Will get back to you soon


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