Articoli e notizie

Il blog di Eld Engineering

Eld Engineering Srls

Home > Articoli > HCL Leap: tables and services

HCL Leap: tables and services

da | 26 Feb 24 | Domino, Domino e Notes 14, HCL Leap

With HCL Leap you can use Services to retrieve data from the current application or from other existing Leap or Domino applications , thus integrating the various data sources present.

It is also a very convenient tool because all the configuration of a service is done using a wizard from Leap’s design interface, so there is no need to write code.

Another interesting feature in HCL Leap are tables , design elements that can be inserted inside a form to fill in records linked to the main form: just think of Notes response documents and you will have an idea of what Leap’s tables are and how they can be used.

Unfortunately, however, I have found that the two elements don’t work together : from a record inserted via a table you can’t hook a service to fill in the data.

Try to think of a form that collects the data of an order where the individual rows of the order are filled precisely through a table . The logic of such an application should be that the individual row uses a service to link to the company’s price list from which to take the data of an item (description, price, etc.).
Here, this operation is currently not possible precisely because a service cannot be hooked from a table (and I would suggest that HCL think about how to remove this limitation).

However, there is a way around this limitation by being able to have the desired behavior in the table.
I first want to thank Marty Lechleider, author of this post who helped me to solve the problem.

The concept is quite simple : if a table in HCL Leap cannot use the service the thing is however possible from the underlying form . Also, the table can get data from the underlying form and then we can use the form as a conduit to get the data in the table.

Here is the sequence I followed:

In the form I create two fields (description and price) that I call :
F_TempDescrizione and F_TempPrezzo .

Both fields will then be hidden.

The F_TempDescrizione field is a dropdown whose choice options are populated via a service with the product list
Again the F_TempDescrizione field invokes another service linked to the onItemChange event that populates my F_TempPrezzo field again from the price list based on the value selected
in the description.

So far everything is standard and no problems.

Then I create the table where I have the two equivalent fields F_DescriptionTable and F_PriceTable and here I apply the code that handles the two hidden fields in the form for me:
In the onShow event of the F_DescriptionTable field I read the options (choices) from the F_TempDescrizione field of the underlying form:

item.setOptions(
app.getForm('F_FormOrdine').getPage('P_Dettagli').F_TempDescrizione.getOptions()
);

then in the onChange event of the F_DescriptionTable field of the table I go and write this line first:

app.getForm('F_FormOrdine').getBO().F_TempDescrizione.setValue(BOA.getValue());

which changes the value of F_TempDescrizione in the form as F_Description in the table changes.
Since the F_TempDescrizione field has service that populates the F_TempPrezzo field this will update automatically.
The last thing I need is to read this updated value, and I do that via this code (again in the onChange event of the F_DescriptionTable field , just below the row I just added)

var servizio = app.getForm('F_FormTicket').getServiceConfiguration('SC_ServiceConfig7');
servizio.connectEvent("onCallFinished", function(success)
{
if(success) {
var p = app.getForm('F_FormOrdine').getPage('P_Dettagli').F_TempPrezzo.getValue();
BO.F_PriceTable.setValue(p);
}
});

How does it work? In the servizio var I reference the service that updates the price, then I have a small onCallFinished listener that waits for the service call to complete.

Right after that it reads the value in the F_TempPrezzo field of the form and writes it to the F_PriceTable field of the table.

And so this problem also found its solution.

HCL Leap

0 commenti