Sage300 VBA field edit control .PUTPRESENTATIONMASK

SUGGESTED

Hi All,

I am doing a "Field Edit Control" and would like to put in a presentation mask.  From the programming guide, there is a property ".PutPresentationMask (????").

But where can I find what are the "Mask example", and what does each characters in the mask represent ?


.PutPresentationType (FLD_PRESENTS_NONE)
.PutType (FLD_CHAR)
.PutPresentationMask ("%-6C")

Many thanks in advance.

  • 0

    You could look at the object models to test out different scenarios that you want to emulate.

  • 0 in reply to Django
    SUGGESTED

    Hi,

    Thanks for the thinker.  I got it.

  • 0

    From the SDK help:

    The mask format string specifier controls:

    · The type of input data.

    · The separator characters.

    · The justification of the input. (Justification can be specified per segment.)

     Each formatting character in the mask string represents a character in the data field that the user can enter. The following table shows the formatting characters allowed:

     

    Formatting characters

    Effect

    A

    Uppercase alpha

    a

    Mixed case alpha

    N

    Uppercase alpha-numeric

    n

    Mixed case alpha-numeric

    D (or d)

    Numeric

    C

    Uppercase printable

    c

    Mixed case printable

     A mask can consist of multiple segments, each with their own format. Use the following formatting characters to specify segment format:

    % Segment format specifier.

    - Segment is left-justified.

    0 Segment is zero padded (numbers only; ignored when left-justified).

    nn Width of Segment (1-255).

     A segment consists of a format specifier followed by a format character. The system treats any other character in the external mask string as a separator. To get a literal percent sign (%) as a separator, use two percent signs (%%).

     The following table gives several examples of valid sMaskFmt strings:

     

    Mask string:

    Result:

    (%-3d) %-3d-%-4d

    Telephone number.

    %24N

    Right-justified, 24 uppercase alpha-numeric characters.

    %05d

    Zero-padded, right-justified, 5 numeric characters.

    %-35c

    Left-justified, 35 mixed case printable characters.

    Cheers

    John

    Dingosoft

    www.dingosoft.co

    ***  Check out our new Sage 300 Financial Reporter: https://youtu.be/KSv-Ee514_U  ***

  • 0 in reply to dingosoft

    Hi John,

    Thanks, that was very helpful.  Sorry, but I cannot seem to format for a decimal. 

    Example I want to mask according to the number of decimal.  I tried "%d.2d",  "%.2d", "%d10.%2". all did not give me 2 decimal.

    Many thanks in advance.

  • 0 in reply to tyk

    Hi Tyk. Masks are only used for text fields. Decimals for numeric values in FieldEditControls are usually controlled by the .CurrencyCode property, however you can also control them with the .NumberDecimalsAfter property.

    Cheers

    John

    Dingosoft

    www.dingosoft.co

    ***  Check out our new Sage 300 Financial Reporter: https://youtu.be/KSv-Ee514_U  ***

  • 0 in reply to dingosoft

    Hi John,

    How about setting the decimal as in per optional field setup ?  I am trying to define a mask for a custom field matching the "Optional field with number definition", where user get to define the number of decimal.

    I cannot locate the .numberdecimalsafter, may I know is it put of "AccpacCustomField" property ?

  • 0 in reply to tyk

    Hi Tyk. No, .CurrencyCode and .NumberDecimalsAfter are FieldEditControl properties. They just change the way the field is displayed - without changing the field itself. If you want to define an AccpacCustomField as a monetary field, you would use .PutType to set it to 6 (FLD_DECIMAL), .PutSize to set the field size to 10 and .PutPrecision to set the decimals to 3. This is the convention for monetary amounts in Sage 300 (there are a couple of Middle Eastern countries that have 3 decimal places in their currency). When you set the currency in the FieldEditControl with .CurrencyCode, it automatically displays the correct number of decimals. BTW: I am an SDK developer - not VBA, but VBA is pretty much the same as the SDK VB screens. Also, 10 is the only size you can use for monetary fields. It actually holds up to 19 digits. If you want a short-cut, you can just use .InitFromField to copy the attributes from an existing view field to your custom field.

    Cheers

    John

    Dingosoft

    www.dingosoft.co

    ***  Check out our new Sage 300 Financial Reporter: https://youtu.be/KSv-Ee514_U  ***

  • 0 in reply to dingosoft
    SUGGESTED

    Hi John,

    Thanks for your reply.  Yes, I got it.