1
0
-1

failure to attempt to save a curency(money) value field


Hi guys,

i´m have a failure to attempt to save a curency(money) value field in this cenario:


1) Test cenario: Insert an value = U$ 1.000,00 in the transaction record to update store credit an another form.

1) The field value of my form is configured with:

    a) Formatting Style: US Style

    b) Number of Decimal : 2

    c) Validator Type: Numeric

    d) Mandatory : Checked


2) This form has a Post Processing update tool with a sql update command to store this field value to another table form.

    SQL Command: "update app_fd_conta_contabil set c_saldo_conta = c_saldo_conta -     FORMAT(#form.app_fd_transacao.id_valor_transacao#, 2)

where ID = '#form.app_fd_transacao.cboCtContabil#'"


3) Result: This update run without execution erros, but your result is  the app to subtrac 1,00 otherwise 1.000,00


Any idea ?


Thanks,

Paulo Nascimento



    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Hi, if you intend to perform calculations, I would suggest to store the value directly as a number instead of a formatted string. Then only use formatting when displaying the output value.

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi Anders, you are okay ?


        In another cenario i´m to attempt to format output collumn in datalist with Bean sell script below:


        String texto = String.format("%,.2f", value);

        texto = texto.replace(",", "#");
        texto = texto.replace(".", ",");
        texto = texto.replace("#", ".");

        return "<span style=\"color:green\">" +  texto + "</span>";

        ------------------------------------------------------------------

        But i´m getting this error message:

        ERROR 07 Sep 2022 14:54:10 org.joget.plugin.enterprise.BeanShellFormatter - jwc_paulomnasc : Error executing script 9920 bsh.EvalError: Sourced file: inline evaluation of: ``String texto = String.format("%,.2f", value); texto = texto.replace(",", "#"); . . . '' : Typed variable declaration : Error in method invocation: Static method format( java.lang.String, java.lang.String ) not found in class'java.lang.String'


        Observation: This code execute ok on java web editor www.jdoodle.com.


        Any idea ?











          CommentAdd your comment...