BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  Initialize options variable on coachviews without a variable associated

    Posted Thu July 23, 2020 09:23 PM
    Hello,

    I'm creating a coachview where I need to declare some options variables but just for internal use of the coach view... The developer that will use the coach view doesn't need to create a variable on it's service just to bind it to the coach view. The problem is that if the developers that's using the coach view doesn't pass a variable, it will be null and some methods will not work.

    To simulate the problem is easy.

    • Create a coach view (I'll name it as CV_Table_Test)
      • On CV_Table_Test, declare a option variable called myTableValues as a NameValuePairList
      • On CV_Table_Test go to Layout tab, drag and drop your myTableValues to the layout (it will create a table component).
      • On CV_Table_Test, click on the table component, go to Configuration tab and mark the option Show Add button

    • Create a Client-Side Human Service (I'll name it as CS_Table) and inside the Coach drag and drop CV_Table_Test.
    If you run CS_Table, you'll see the table, but if you click on the plus sign, no new line will be added.

    If you create a private variable on CS_Table, initialize it (marking has default option) and bind it to the myTableValue, then run the service, you'll see the when you click on the plus sign, it will add a new line.
    I want to have the same behavior, but without create the variable on the Client-Side Human service. I want this because my table will be populated by a service call that's already being called by my coach view.

    I've tried to see how internal components work and could see that somethimes they use funcions like:

    bpmext.ui.substituteConfigOption or bpmext.ui.substituteObject

    ...but I haven't success using it.

    I really appreciate any help.

    Thanks





    ------------------------------
    Ranieri Mazili
    ------------------------------


  • 2.  RE: Initialize options variable on coachviews without a variable associated

    Posted Fri July 24, 2020 06:33 AM

    Hi,

    I don't think it's possible. If you don't create and bind a variable from CSHS, there is no place to save the table data in the backend, so I will through an error.

    Thanks,



    ------------------------------
    Tung Nguyen
    ------------------------------



  • 3.  RE: Initialize options variable on coachviews without a variable associated

    Posted Fri July 24, 2020 06:41 AM
    Why would you need some configuration options which will not have binding with server side variables, I don't really understand the purpose ?
    Why don't you simply declare some JavaScript variables within the CoachView ? like - 
    var str = "";
    var complexObj = {};
    var arr = [];


    ------------------------------
    Atanu Roy
    ------------------------------



  • 4.  RE: Initialize options variable on coachviews without a variable associated

    Posted Fri July 24, 2020 06:50 AM
    Because javascript variables cannot be binded to coachviews. You cannot bind your "complexObj" to a table component.

    ------------------------------
    Ranieri Mazili
    ------------------------------



  • 5.  RE: Initialize options variable on coachviews without a variable associated

    Posted Fri July 24, 2020 07:52 AM
    I think I am still not getting the purpose.
    As you mentioned in the original post, that you have a service which will be feeding the data to the table, if yes, you can use Service Data Table instead, that will not require any binding. But my question is - if you are fetching the data from the service why would you want to have an Add button ? Where are you trying to store the added element and the updated list ?

    If you trying to add an element to the table just for display purpose, you can have a separate button and on click of that button you can append an element like - 
    page.ui.get("Service_Data_Table1").appendElement({"name":"strVal", "value": "strVal"});;


    ------------------------------
    Atanu Roy
    ------------------------------



  • 6.  RE: Initialize options variable on coachviews without a variable associated
    Best Answer

    Posted Fri July 24, 2020 10:38 AM
    Hi Ranieri,

    It sounds like you are trying to create some private local variables in Coach View without defining them on the parent CSHS.  Unfortunately, this will not work.  As Atanu mentions, you can you a Service Data Table to display data, then programmatically add a row.  However, the Service Data Table is not rendering Coach Views to display the data,  It is merely an HTML output.  Are you trying to use Coach Views in the Table or have editable data?

    The bpmext.ui.substituteConfigOption is a helper function designed to default a config value.  This simply allows us to avoid having to null check every context option before evaluating the condition.  You might get somewhere by creating your own list object programmatically and attaching it to the Table.  However, you would need to extend the Table control into your own tooolkit, which unfortunately means it would no longer receive updates or be supported.

    It may be best to state your use case, and perhaps we could point you in the direction of a better solution.


    ------------------------------
    Stephen Perez
    ------------------------------



  • 7.  RE: Initialize options variable on coachviews without a variable associated

    Posted Mon July 27, 2020 09:56 AM
    Thank you @Stephen Perez and @Atanu Roy.
    Now I understand the the usage for substituteConfigOption and I can "solve" my problem using Service Data Table.
    Now I have another problem with Service Data Table, but it's another thread :)

    Thanks​​

    ------------------------------
    Ranieri Mazili
    ------------------------------