by Izertis

Create documents in docx, xlsx (MS Office Word and Excel), odt, ods (LibreOffice and OpenOffice) and pdf format without MS Office or others plugins installed from any module and subpanel using templates.

Includes a 30 day guarantee
Try it Now

By clicking you consent to share your profile with the developer

#2008 - Remove decimal from Price field

Closed Feature created by rossella 6 years ago

Hello, is there a function to truncate a numeric field to remove decimals? Best regrds,

Rossella

  1. dharma member avatar

    Izertis Provider

    6 years ago

    Hello,

    Yes, for numeric fields:

    Example: Original field: [a.m2_surface] Field with 4 decimals: [a.m2_surface;onformat=~f_Decimals(4)] Field with 3 decimals: [a.m2_surface;onformat=~f_Decimals(3)] Field with 0 decimals: [a.m2_surface;onformat=~f_Decimals(0)]

    Regards,

    Anabel

  2. rossella member avatar

    rossella

    6 years ago

    Hello, I get the error

    TinyButStrong Error in field [a.total_amount...]: (parameter onformat) Expression '~f_Decimals(0)' is invalid because 'f_Decimals(0)' is not a method in the class 'Generate_Document'.

    TinyButStrong Error Show() Method: The output is cancelled by the OpenTBS plugin because at least one error has occured.

    total_amount is of type Currency.

    Thanks for your help,

    Rossella

  3. dharma member avatar

    Izertis Provider

    6 years ago

    Hello Rossella,

    The f_Decimals was added to the pluging in the 2.2.0 version: - New format function 'f_Decimals', format number of decimals of floats and decimal variables. Example: [a.numvar;onformat=~f_Decimals(1)] Which MMR version are you using?

    And, please, verify that you are using the correct dataset ("a.").

    Regards,

    Anabel

    • rossella member avatar

      rossella

      6 years ago

      Hello Anabel, My version is 2.3.0. I have tried again and this time it does not return an error but it does not format the number. [a;block=w:body;sub1=aos_products_quotes] .... [a.total_amount;onformat=~f_Decimals(1)] returns 7,800.00

      Thanks, Rossella

  4. dharma member avatar

    Izertis Provider

    6 years ago

    Hi Rossella,

    We tested the 2.3.0 version in a Sugar 6.5.22 CE instance and it works. Please, download two images, that prove that it is works, and the template we have used from the next link: http://we.tl/3RYXBtuNqg

    Let me know if that template works in your installation.

    Regards,

    Anabel

  5. rossella member avatar

    rossella

    6 years ago

    Hi Anabel,

    I have solved the mistery by looking at the differences between my script and yours. I had the function [a.total_amount;onformat=~f_Decimals(0)] written with font Calibri but tilde that was written in Tahoma font causing the troubles. Many thanks for your continuous support

    Regards,

    Rossella

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...
Rating