Page 1 of 1

Afterbrowse Lookup NuNumber value incorrect

Posted: Fri Jun 27, 2025 4:06 pm
by 88tc88
Hi all,

Currently I am having strugles with formatting my NuNumbers in the correct monetary format.

I have a Lookup object in a subform that uses an after browse PHP code to automatically fill the other object in the same subform row.
However, when performing the following after browse code, the value is shown 100x as high.

Code: Select all

$lu = nuLookupRecord();
nuSetFormValue('offerteitem_stukprijs', $lu->artikel_standaardprijs);
The artikel_standaardprijs is the standard price of an article. This artikel_standaardprijs is in the database stored as an decimal(10,2). This value needs to be filled in as the offerteitem_stukprijs, with a nunumber format of '€ 1.000,00'.

What now happens is the following. For instance, the artikel_standaardprijs is '19.00' in the database. When I perform the lookup, the offerteitem_stukprijs shows '€ 1.900,00' instead of '€ 19,00'. With all the other object in my nubuilder environment it handles the differences in . and , correctly.

Thanks in advance for your help

Re: Afterbrowse Lookup NuNumber value incorrect

Posted: Fri Jun 27, 2025 7:40 pm
by kev1n
Hi,

Is it possible to show a screenshot?

Re: Afterbrowse Lookup NuNumber value incorrect

Posted: Fri Jun 27, 2025 10:04 pm
by 88tc88
kev1n wrote: Fri Jun 27, 2025 7:40 pm Hi,

Is it possible to show a screenshot?
Sure!

Re: Afterbrowse Lookup NuNumber value incorrect

Posted: Sat Jun 28, 2025 6:30 am
by kev1n
Since 'artikel_standaardprijs' uses a comma instead of a dot as the decimal separator, we need to convert it before setting the value.

Code: Select all

$lu = nuLookupRecord();

$standaardprijs = str_replace('.', ',', $lu->artikel_standaardprijs);

nuSetFormValue('offerteitem_stukprijs', $standaardprijs);