Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
apex.item().setValue() does not work with addition?

I'm using oracle apex version 20.1 and I can not get past this weird javascript error. I have a dynamic action that populates a page item (P616_FRM_AMT2) based on the getValue() of another page item (P616_TO_AMT1) with a little addition inside the setValue() function. The result i'm trying to achieve in this example is 10.01. The problem in the code is pretty self explanatory, can someone explain how this is possible?

// Get value of first page item
to_amt = apex.item( "P616_TO_AMT1" ).getValue(); // returns 10

// Examples of using arithmetic in the .setValue() working correctly
apex.item("P616_FRM_AMT2").setValue(to_amt/10); // returns 1
apex.item("P616_FRM_AMT2").setValue(to_amt*10); // returns 100
apex.item("P616_FRM_AMT2").setValue(to_amt-1); // returns 9
apex.item("P616_FRM_AMT2").setValue(to_amt-1.01); // returns 8.99

// Using addition in the .setValue()
apex.item("P616_FRM_AMT2").setValue(to_amt+1); // returns 101

// What I actually need to do
apex.item("P616_FRM_AMT2").setValue(to_amt+.01); //returns 100.01 

// Had to add this edit because it changes my question, addition works with ONLY static values?
apex.item("P616_FRM_AMT2").setValue(10+.01); //returns 10.01 
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

First check what getValue() actually returns:

enter image description here

Looks like the javascript variable is a string

Now take apex out of the equation and check what javascript does with numbers vs strings when doing "+.01".

enter image description here

There you go, this is how javascript handles it. You're relying on implicit conversion in javascript, assuming that it will handle that correctly. I think you will find the answer in javascript forums if you really want to know why this exact behaviour happens. Or just do the conversion yourself to avoid any confusion...

enter image description here

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda