` Printed Icetips Article

Icetips Article



Par2: Working with 2 or 4 Decimal Places
2003-11-18 -- Ray Goudie
 
In your dictionary file defintion, use the four decimal places for all
monetary fields, as required by spec.  Ensure that every such monetary field
has a constant picture, say, "@n14.4".

In your config file, have a byte that determines how many decimnal digits a
particular customer wants to use.  Then, in the Init method of your form
windows, just after opening the window, you loop through all the fields and
if the fields picture is equal to "@n14.4", you replace the picture with the
appropriate picture according to the user's preference:

---

currentField = 0
loop
    currentField = window{PROP:NextField, currentField}
    if currentField = 0
        break
    end

    if (currentField{PROP:Type} = CREATE:Entry) and |
       (currentField{PROP:Text} = '@n14.4')
        case decimalPlaces
        of 2
            currentField{PROP:Text} = '@n12.2'
        of 3
            currentField{PROP:Text} = '@n13.3'
        end
    end
end

---

I feel that there may be more effective methods, but none come to mind at
this time.



Printed November 23, 2024, 8:23 pm
This article has been viewed/printed 35220 times.