fineract-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Woodlock <keithwoodl...@gmail.com>
Subject Re: Expression language to extend datatables
Date Wed, 24 Feb 2016 09:54:05 GMT
Hi Sander,

>> We've been using the datatables quite extensively with more and more of
our
>> clients, and have also been extending it a bit to make it more suitable
for
>> offline use on a tablet etc.

Very good. Be interesting to hear more of what you did to support the
offline scenarios. I must take a look at the code area to see it.

>> The next step now would be to derive some of the fields in a datatable
from
>> simple IF/ELSE statements or basic math formula's on other fields. For
>> example: The customer has entered a weekly income of 100 (field A) and a
>> weekly cost of 50 field (B) and we don't want a loan to take up more than
>> 30% of his/her profits then in field C the formula would be (A-B)*30% =
15.
>> This would then obviously be stored and recalculated upon edit (if
needed).

Assuming that the datatables still just supports the CRUD methods over a
table, I suppose you are looking here to capture some rules onCreate or
onUpdate of the record in the 'table'.

If you were ok with a 'Compile' time solution you could put in simple Java
code to 'handleOnUpdateDatatableRules' or 'handleOnCreateDatatableRules' -
That method might then use a naming convention based on the datatable name
in use and some reflection to trigger call to a method written in java that
contains your rules/logic.

If you really wanted it to be runtime changable, then you would need to
support a datatable to rules type relationship. You would want to be able
to write in your rule is some scripting language. One possibility is to use
Javascript - you can invoke it using Nashorn (
http://www.oracle.com/technetwork/articles/java/jf14-nashorn-2126515.html)

regards,

Keith

On Wed, Feb 24, 2016 at 7:16 AM, Sander van der Heyden <
sandervanderheyden@musoni.eu> wrote:

> Hi all,
>
> We've been using the datatables quite extensively with more and more of our
> clients, and have also been extending it a bit to make it more suitable for
> offline use on a tablet etc.
>
> The next step now would be to derive some of the fields in a datatable from
> simple IF/ELSE statements or basic math formula's on other fields. For
> example: The customer has entered a weekly income of 100 (field A) and a
> weekly cost of 50 field (B) and we don't want a loan to take up more than
> 30% of his/her profits then in field C the formula would be (A-B)*30% = 15.
> This would then obviously be stored and recalculated upon edit (if needed).
>
> To implement this we can obviously already leverage the various metadata
> tables we have around datatables, but I was not sure which expression
> library would be most suitable. I've currently looked around and wrote-off
> anything not suitable under the Apache license, or that has not had any
> contributions for a long time. This turned up Apache jEXL -
> http://commons.apache.org/proper/commons-jexl/. I was wondering if any of
> you had any experiences with it or have alternatives that are better
> suited?
>
>
> Thanks,
> Sander
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message