Conversion money fields from/to Cents

Dear All,

I have a integer / money field named ‘price’.

During data entry (add/edit), I can enter as float 1234.56 (dollar and cent). But to save, I’ll like to store it as integer 123456 (so call cent)

And in list page, I prefer it to show in this format Rp 1.234,56 (like locale: id_ID)

My question is, I think the save part is quit straight forward, just do it in
Server Events → Table-Specific → Common → Row_Inserting & Row_Editing
$rsnew[‘price’] *= 100;

But where should I place the code for
$rsnew[‘price’] /= 100;
in order to show the output in list and during edit page as 1,234.56 or 1.234,56

Thanks in advance.

You may simply use Row_Rendered server event:

if (CurrentPageID() == "list" || CurrentPageID() == "view") {
    $this->price->ViewValue = $this->price->CurrentValue / 100;
}
if (CurrentPageID() == "edit") {
    if (!empty($this->price->EditValue)) {
        $this->price->EditValue = $this->price->EditValue / 100;
    }
}

This code is working. But the locale setting are gone once perform this step.
Is there anyway to preserve the locale setting after apply above code?

Regards,

Found solution:-

$this->price->ViewValue = FormatCurrency(($this->price->CurrentValue / 100), $this->price->formatPattern());