Script to Format as Currency & Ignore Commas

I am working on fields that eventually will be summed. I have some custom keystroke scripts, so I have had to use javascript to do the formating (I want currency). Here's what I have so far:
this.getField(event.target.name).setAction("Format", 'AFNumber_Format(2, 0, 0, 0, "$", true)');
This is working for me, an when you type "1" into the field, it makes it into "$1.00", which is what I want. However, if I type in "5,000" it reads that as "5" when everything is summed up. I can only figure it is reading the comma as a decimal point. I thought the above code indicates that it should use commas as the seperator value (hence the 0 in that attribute's place in the formula). I just can't crack this problem. Any ideas or code? Thank you in advance.

Actually the script was running fine. This is what I ultimately came up with to solve the problem.
Formatting
AFNumber_Format(2, 0, 0, 0, "$", true)
Keystroke Script
event.value = event.value.replace(",","");
Message was edited by: jbash83 edited to remove unrelated code

Similar Messages

  • Make calculated fields default to blank - format with currency when filled

    Hi!
    I'm creating a standard invoice. quantity x price = subtotal...
    I don't want a column of zeros strewn across my page, so I found a simple bit of javascript online render the fields blank when valued at zero:
    if (event.value == 0) {
    event.value = ''
    My 'working' knowledge of javascript is limited at best... but that seems to do the job nicely. The next problem arises when I then try to format these fields as currency.
    The simplest way to do this is through the format tab in the field properties, but doing so seems to remove the formatting applied through scripts since that would be a different formatting option.
    So it would seem if I'm going to use a script to render the feilds blank, I'll also need to use a script to format the feilds as currency?
    Any suggestions?
    Thanks

    Ah ha! Always nice when the solution is simpler than expected.
    Working perfectly now, thanks!

  • Formatting a currency field

    I have a currency formatted field that completes a calculation.  Is there a way to format a field so that if the answer is $0.00, that it will not show and print?

    The only way I could get it to take the validation is to type the following:  if(+event.value==0)event.value="";
    But when I put that in my field - it still prints $0.00.  Is it because my formula is not addition but multiplying two fields? 
    You mentioned that I may have to change some field values first?  The two fields that my original formula is figuring are formatted for a number and the second field is formatted for currency.  So the total is in a field formatted for numbers - with a $ sign and a space before the number.  I have about 30 lines figured for this, but even when I have no entry in either one of the fields, I still get a $0.00.  I really do not want anything to show up unless there is an entry in that field.

  • Currency with commas

    Hi all,
    I have a problem of displaying currency fetched from KONP table with commas.
    Its not related to displaying the currency with commas.
    I want to store the fetched value of currency with commas into some variable for further processing.
    Scenario>>
    If currecny value is 1000 in KONP,then i need this value to be stored in some variable as 1,000.
    Thanks,
    Anurodh

    Hi,
    you can use the WRITE statement to get the thousand seprator..
    l_curr = '1000'.
    WRITE l_curr to l_char. " l_char will hold 1,000

  • Help with formatting multiline output into comma delimited ordered output

    I have 2 tables:
    SQL> desc table_1;
    Name Null? Type
    ===================================
    ID NOT NULL NUMBER
    DATA1 NOT NULL VARCHAR2(440)
    DATA2 NOT NULL VARCHAR2(1024)
    SQL> desc table_2;
    Name Null? Type
    ===================================
    ID NOT NULL NUMBER
    ATTNAME NOT NULL VARCHAR2(255)
    ATTVAL                          VARCHAR2 (4000)
    DATA1 NOT NULL CHAR(1)
    DATA2                          VARCHAR2 (2000)
    DATA3                          VARCHAR2 (255)
    I need to get ATTVAL from where e.g. ATTNAME=att_name1 to ATTNAME=att_name6 from every entry (with its unique ID), and format the output into comma delimited format in e.g. this order:
    att_val1,att_val3,att_val6,att_val4,att_val5,att_val6
    So e.g. for entry with ID "9812" from the query below, the output I need would be:
    187,179,156,134,1436,1809
    What I've got so far is as follows:
    SQL> SELECT id,attname,attval FROM table_2 WHERE id in (SELECT id from table_1 WHERE data2='xxx')
    AND attname in ('att_name1','att_name3','att_name6','att_name4','att_name5','att_name6');
    ID               ATTNAME               ATTVAL
    ===============================
    1970 att_name1 123
    1970 att_name2 abc
    1970 att_name3 1234
    1970 att_name4 def
    1970 att_name5 1134
    1970 att_name6 ghj
    9812 att_name4 134
    9812 att_name5 1436
    9812 att_name3 156
    9812 att_name1 187
    9812 att_name2 179
    9812 att_name6 1809
    77 att_name1 1980
    77 att_name5 1867
    77 att_name3 174
    77 att_name4 1345
    77 att_name2 1345
    77 att_name6 1345
    but I don't know how to format the output comma limited in certain order. (or if this is the best way of getting the data out)
    Would someone have idea how this could be done?

    846954 wrote:
    Thanks Frank!
    I got much further now :).
    I've got Oracle 10g So I used the "SYS_CONNECT_BY_PATH" for my query.
    Now I get the output in the format I want, however, it comes out in the order that the attributes are (which is pretty random).The values you posted are in order: 'attval1' < 'attval2' < ...
    So I'm using this now(had to use "|" as separator because SYS_CONNECT_BY_PATH would not work with comma due to some of the attval having comma in them ):The values you posted don't contain and commas.
    You're hiding what the problem is. It would really help if you posted actual data. It always helps if you post CREATE TABLE and INSERT statements for a little sample data, and the results you want from that data.
    Assuming you really have something that has to be in a certain order, and that order is not based on anything in the values themselves, then DECODE might be a good way to do it. Storing the sort value in a table might be even better.
    It looks like you were using an Oracle 9 exanple. In Oracle 10, using SYS_CONNECT_BY_PATH is simpler:
    SELECT     id
    ,     LTRIM ( SYS_CONNECT_BY_PATH (attval, '|')
               , '|'
               )          AS attvals
    FROM     (
              SELECT     id
              ,     attval
              ,     ROW_NUMBER () OVER ( PARTITION BY  id
                                  ORDER BY          DECODE (...)
                                )     AS curr
              WHERE     id     IN (
                             SELECT  id
                             FROM     table_1
                             WHERE     data2     = 'xxx'
              AND     attname     IN ('attname1','attname2','attname3','attname4','attname5','attname6')
    WHERE     CONNECT_BY_ISLEAF     = 1
    START WITH     curr     = 1
    CONNECT BY     curr     = PRIOR curr + 1
         AND     id     = PRIOR id
    ;You don't need two almost-identical ROW_NUMBERs; one will do just fine.

  • Does the new Numbers allow for formatting for currency?

    I have just updated my computer to Yosemite and updated Numbers and Pages as well.  Is there somewhere that I can format the cells to e.g. currency, as in the older versions?
    Thank you

    On the View menu, Show Inspector. Then in Inspector (right side pane) click Cell at the top and then set Data Format to Currency.

  • Format mask (currency)

    Hello guys,
    I was wondering what would be the correct place to set a format mask (currency) using Jheadstart 10.1.3.
    Regards,
    Maik Verbaan

    Hi Maik,
    We have a "regular expression" field to validate the item, and an error that can be thrown if the input does not comply with the regular expression.
    Regards,
    Evert-Jan de Bruin
    JHeadstart Team

  • Format of currency incorrect

    Hi
    I have several smartforms which are dispaying various amount fields which are all listed in the Global Definition settings under the tab 'Currency/Quant.Fields' and referency a currency field.
    I have a problem where in one particular smartform I am doing exactly the same thing execpt the currency format is not displaying correctly as the other forms.
    In this particular case we are displaying Zambian Kwachas and the format should be 1,000 which is displaying in all forms but the trouble form is displaying 1.000 - with a fullstop instead of a comma.
    In debug the amounts between the forms are all the same and there is nothing unique which should make the formats different.
    Does anyone know why this one would print with an incorrect format?
    Thanks.
    Regards
    Lyndon

    Hi Guys
    Thank you both very much, this is a very big help. Murphey's law is that our Dev system is down so I can't test this. I think that it might be a combination of both SU01 and the SPRO settings, in SU01 the settings are correct whereas is SPRO the settings are wrong, maybe that is why some forms print correctly while others are wrong.
    Thanks!

  • Output Format for Currency

    Hi There,
    I have set defaults as '1,000.00' for currency output in the own data but in the output of report it is showing like '1.000,00'.
    PS: there is no formating statement in the program as well.
    Any advice friends, how can I make it in required format.
    Regards,
    Shabbar

    HI ali ,
    yeah u can do thi sin scripts ..
    take a look at this ..
    Country-Dependent Formatting: SET COUNTRY The formatting for certain field types depends on the country settings. These field types include, for example, date fields and number fields that include either a decimal point or the ‘thousands’ separator character. The formatting options defined in the user master record are usually the ones used here. To choose a formatting option other than the one specified in the user master record, use the SET COUNTRY control command. The country-dependent formatting options are stored in the T005X table. Syntax: /: SET COUNTRY country_key You can enter the country key either as a literal value enclosed in quotes or as a symbol.
    /: SET COUNTRY 'CAN' /: SET COUNTRY &country_key& Use a blank country name to revert to the setting found in the user master record: /: SET COUNTRY ' ' This SAPscript command actually calls the corresponding ABAP command internally. This guarantees the effect of the SAPscript command to be identical with that of the ABAP command
    regards,
    VIjay
    Message was edited by:
            vijay k

  • Formatting numbers currency export to excel

    All
    I have the following SQL in my code.
    select trader, tradername, billingranacc,BILLINGPREFRANACC,LASTLOGINDATE, '€' ||to_char(billingamount,'99G999D99') Amount,substr(BILLINGPREFRANACC,1,1) as "R&NLocation"  from exlink_trader_import where usertype = 'Internal' and isbilled = 'Yes' and isdeleted = '0'Now the report picks up the € sign but when i export to excel it does not, can someone help with this ?

    Hi stranger colleague Ben
    The CSV codification is one but not the one issue that can affect the unexpected output of your report.
    But if you are viewing correctly the € symbol in your report, and the automatic CSV codification is enabled, sure you are in the usual case that makes more difficult the work of foreign developers and DBAs.
    Time before I resolved the wrong CSV output (“â‚ 600.00”) instead of the correct (“$ 600.00”) simply turning ON the automatic codification, but only after being managed many NLS parameters, and database character sets. We have different currency, keyboards, measure units than Americans, and have to read more chapters in documentation books. This is more pain if you are far to domain the English language!.
    Ben: you are getting the wrong output using the “ '€' || to_char (billingamount, '99G999D99')” format in the query, Have you checked using “billingamount” in the query, and defining the FML99G999D99 or FMU99G999D99 format in the report column numeric attribute?, You should seen the correct € output in the CSV file although you haven’t defined the automatic codification.

  • Formatting a currency in different format for 2 company codes

    Hi,
    I have two company codes(MCFL and MIL) in Indian project, now my requirement is to maintain different currency format which means company code specific.
    In PO print I wanted to show as different format.
    Is it possible to do setting in customizing level.
    Regards,
    Vadamalai A

    Hi,
       You can set the decimal notation format at user level. Go to Su3 - Defaults tab and maintain the format at user level.
        If you want different format in printout, then you need to put the logic in the smartform only, to validate the country and pout the corresponding format.
        Revert back if your question is different.
    Regards,
    AKPT

  • Open Hub File ignores comma separator

    Hi friends,
    I've got a problem while extracting a csv file with an open hub service.
    In the system my user (tab default) has US decimal format, and I can see the values in the infocubes correctly.
    But when I extract this values thru open hub service to a csv file, the comma separator and decimal point disappear.
    I thought it was a problem of the configuration of my pc, so I modified the regional options selecting US format.
    But, even doing this, when I open the csv file with excel the comma separator and decimal point doesn't exist.
    I know there exist a transaction called something like "RSRVT" or similar that can definy the thousand separator, but I don't remember the exact name.
    The field that I'm interested in the open hub file is defined as NUMC, length 17 and 3 decimal. I've tried to define with DEC format or CURR with similar result (totally failed).
    Can anybody help me!... this is very urgent.
    Thanks a lot.
    Francis.

    Hi
    check out this link too...
    http://help.sap.com/saphelp_nw2004s/helpdata/en/8e/dbe92341c84242be2c7d3917f1c197/frameset.htm
    Re: Flat file data load
    swetha

  • Formating long currency field

    Hi all.
    I'm looking forward to format the output of a long currency field. I would like to display it without decimals and using the dot separator, for example: in database i have the value 1234567891011,1234 then display 1.234.567.891.011,1234 is there any function module to archieve this?
    Regards.

    Hi,
    No Need of Function Moudule you can do it with ABAP code..
    Here is the Example for this..
    data: amount(15) type c value '200,000,000.000'.
    while sy-subrc = 0.
    replace ',' with space into amount.
    endwhile.
    condense amount no-gaps.
    write:/ amount.
    Change code according to your requirements for dots and space.
    Reward Points if It is Helpful.
    Regards,
    Bohra.

  • Script Paragraph Format-TAB position Problem....

    In Script- Medruck , There is a line:
    IM   ,,,,,,Qty. ,,Unit   ,,Deliv. date ,,,,&ETUHRTXT&
    where IM is a paragraph format with TAB positions at:2,3,23,24,34,40,51,57.
    what is the meaning of ,,,,,,Qty ????
    what is the difference in writing :
    IM ,,Qty,,Unit,,Deliv. date,,&ETUHRTXT&                                 AND
    IM   ,,,,,,Qty. ,,Unit   ,,Deliv. date ,,,,&ETUHRTXT&
    How would the Display look like??

    Hi Srikar again,
    If you are putting one tab position after every field, in this case count tab position from the starting i.e. from first variable and go on countin till end . This will take you adding position one after other and it will not overlap.
    e.g. Mat,,qty,,price
    and tab position as 1 : 5  2: 10 3: 15 4:20
    then mat will start at 1 to 5 and qty will from 10 onward.
    Regards,
    Vijay

  • Character format  to currency format conversion?

    Hai,
    I have a field (char16) with value in the form 9800.50. How do I convert it into standard SAP currency type ( of the format 9.800,50 ) Is there any function module available ?
    I have tried the FM "CHAR_FLTP_CONVERSION". But it can't convert decimals (like 9800.50)
    Kindly help me. Thanks in advance..
    Deepak.

    Hi,
    Try this.
    Call function 'BAPI_CURRENCY_CONV_TO_INTERNAL '
    Exporting
    currency = 'USD'
    Amount External = V_Amount
    Importing
    Amount External = V_Amt
    Reward if helpful.
    Regards,
    ramya

Maybe you are looking for

  • How can I print ONLY the active document?

    Whenever I go to File/Print the darn PSE 9 program sends all of the working files in the bin to the printer. I've searched online for 2 hours now looking for an answer. I like to work with having several to many files in the 'bin' and prefer to only

  • Apple remote app loses connection

    I am using the remote app to control my Itune on my computer on Vista. I am able to initiate the connection. But when I close the remote and re-open I still see the library but I am not able to open it. I able to reconnect if disable and re-enable ho

  • How to implement reason for rejection step

    Hi Friends, I want to create a sales order approval and rejection steps using workflow. For this I have created User Decision Step where I have included approval and rejection decisions. When approver presses approve or rejection button, immediately

  • Delay when using illustrator

    Downloaded the new CC today - When I try and do anything in Illustrator there is a delay which is very frustrating - ie when I select something is takes a second or two to actually select

  • Airport extreme firmware update 19 Jan 2011

    Today I was foolish enough to install the new firmware settings. the immediate effect was to remove me from the internet. I have tried factory reset and resetting the network but to no avail. Network diagnostics shows the status of settings OK except