Force leading zeros

For some reason I can't remember how to force a number to show leading zeros in a fixed length field, i.e. 80  is 0080, 240 as 0240. I'd blame it on Monday but I couldn't think of it on Friday, either.
Thanks!
Robin

Thanks for your response. I had to change the cstr to totext in order for it to work, but then it was perfect!

Similar Messages

  • Report Builder: output to Excel removes leading zeros

    I'm trying to use the Report Builder to output a numeric
    field to EXCEL , but on numbers that start with zero EXCEL removes
    the leading zero's. ex. 00123 becomes 123.
    Is there something that I can put in the expression builder
    on the field to overcome this.
    I've tried concatonating a single quote on the front of the
    field but the single quote shows up on the output. I've tried this
    on both the SQL and on the expression builder.
    I've read on some of the posts where people have tried using
    'mso-number-format:"\@'" within a TD tag but I can't seem to get
    the syntax right inside the Expression Builder.
    Has anybody got any suggestions?

    Excel will remove leading zeros in a numeric field because it is treating the column as numeric. Putting a ' in front of the number forces Excel to treat the column as text.

  • How to add leading zeros to a characteristic in CT04

    The business is requesting that we change a class characteristic so that it adds leading zeros.  Currently the characteristic is set as numeric with length of 6, no decimals.  Is there any way via template or otherwise to force this characteristic to store leading zeros, as recorded against the characteristic?

    Hi David,
    1. If you are mentioning about the "Characteristics"This is Standard Field name.
    2. You will not be able to influence the same,
    3. Also i doubt if you are talking about the Characteristic Value - Since only in the Char Value we will be able to define the length, etc.
    4. In case of Charvalues if you want leading zeros then create it as character , where you can store with leading zero
    Reg,
    Dsk

  • How to display leading zeros in a report

    Hi folks,
    I am doing a HR report and the users are very much used to seeing a two digit numeric value as the pay scale since their legacy days.
    In BW, I have the Pay Scale defined as a character (2) and it shows the values on the report as follows:
    Pay Scale
    0
    1
    2
    3
    11, etc.
    But the users would like to see 00, 01, 02, 03, 11, etc.
    Under the query properties, display tab, there are four separate options - display zeros, show zeros as, etc. I tried all the options but the pay scale still does not show the leading zeros. I remember seeing a SAP note a while back that talks about this. Does anybody know how to force the leading zeros on the BEx report.
    Thanks.
    Abdul

    Try removing the ALPHA Conversion from info object defintion.

  • Leading Zeros in Cost Center Account Creation

    Hi All,
    I am creating new cost centers using KS01. The problem I have is that the numbering system that my client requires have leading zeros for some of the cost centers, e.g. 00702. However, the system is not taking the leading zeros and creating them as 702 using my earlier example. Is there any way I can force the system to accept the leading zeros. Thank you for your responses.
    Regards,
    Yomi

    Hi,
    I do not think it is feasible... have a read on this OSS note :
    Note 106971 - FAQ: Automatic Leading Zeroes for Numeric Fields
    Hope this helps.
    Cheers,
    Gimmo

  • Need leading zeros to fill the front of a 10 character parameter being passed-HELP!

    I have a prompt 10 character parameter that some people forget to insert the zero at the beginning of the number. ex.(they type "594468010", suppose to be "0594468010").  How can I fill in the leading zeros for them after they type in the prompt box?  My prompt comes from a command.  Here is a sample of the where clause:  WHERE DB.ID_NUMBER = '{?I_IDNO}'
    I tried to use LPAD('{?I_IDNO}',10,0), it works with plsql, but not when I run the crystal report.
    Does anyone have any ideas?  thanks for your help in advance!

    a) you can always use your database specific cast / convert function to convert the text field into a number for the purpose of record selection. then change the prompt type to numeric. crystal commands are database specific so you'd want to check your database help on what specific syntax to use for the cast / convert in the command.
    b) the other choice to leave the command & prompt type alone & use an edit mask on the command prompt...this would then force the end user to enter the leading zeroes as the edit mask would force a certain length on the entry. so in the crystal field explorer edit the prompt and put in an edit mask of 000000000 for example if you wish to force the end user to enter 9 numeric characters.

  • Leading zeros problem with custom popup

    I've implemented a custom popup page following the How-To docs on the topic. The value I'm return to the calling page in the passback function most often will have leading zeros. So from the custom popup I do a call like this: javascript:passback(00363644). When my value arrives back on the calling page it's converted to 124836 (haven't yet figured out what kind of conversion is happening there).
    I realize this is not a javascript forum (and I've Googled for leading zeros in javascript to no avail - yet) but the HTML DB field type Popup LOV seems to accomplish this just fine so I was wondering how Oracle might be doing it. Anyone have any ideas?
    Earl

    Vikas,
    See
    http://tinypic.com/ibbfoy.jpg
    So, just use
    javascript:passback("00363644")and it should do what you want.You would think. But I've tried:
    wrapping it in single quotes:
    opener.document.getElementById('P6_CONTACT_ID').value = "'" + myVal + "'";
    wrapping it in single quotes:
    opener.document.getElementById('P6_CONTACT_ID').value = """ + myVal + """;
    and the other 'trick' that I've seen mentioned several places, concatenating an empty string to the value:
    opener.document.getElementById('P6_CONTACT_ID').value = "" + myVal;
    All to no avail! This is really frustrating. Supposedly, any string concatenation action will 'force' the value to retain it's original 'string-ness'.
    Working off this assumption and thinking that the conversion had already taken place by the time I assigned the value I backed up a step and assigned the value to a variable before trying to set the value, ala:
    var myVal = p_Value.toString();
    opener.document.getElementById('P6_CONTACT_ID').value = myVal;
    and still no joy.
    Following this logic one step further, do I need to get the value to a string in the original call. This will be a challenge because the link in the popup report is a is set to a URL with javascript call, like this: javascript:passback(#CONTACT_ID#);
    Further, when I float over the links with the mouse I can see the URL in the status bar of the browser as javascript:passback(00363644); So, how do I go about wrapping this in quotes in the link?
    Any help???
    Earl

  • Exporting Numbers file with leading zeros as csv file

    When I export a list of mobile phone numbers with leading zeros (086* etc.) from Numbers as a csv file, the leading zeros are stripped out, although the cells are previously formatted as text. What can I do about this?

    "When I export a list of mobile phone numbers with leading zeros (086* etc.) from Numbers as a csv file, the leading zeros are stripped out, although the cells are previously formatted as text. What can I do about this?"
    Well, the first thing you could do would be to post your question in one of the forums for Numbers.
    Click Discussions to get to the Discussions index page, then the section for the version of iWork you're using, then the Numbers forum in that section.
    In AppleWorks (which doesn't offer an opportunity to Save as or Export as csv) I'd force the application to see the phone numbers as text by inserting some non-numeric characters into the string of digits.
    Examples: 000-123-4567, 000 123 4567
    It may also be a function of the application you are using to open the csv file.
    When I did a brief test of the suggestion above with Numbers '09, I got this result on opening the file in Text Edit:
    ,1234567890,num
    ,123-456-7890,tex
    ,0123456789,num
    ,012-345-6789,tex
    ,0001234567,num
    ,000-123-4567,tex
    Note that both the examples entered as a string of digits only (num) and those entered with inserted hyphens (tex) kept the leading zeroes. Cell format for the column containing the phone numbers was set to Text.
    Regards,
    Barry

  • Require a Number Format Mask to show leading zeros on decimals

    Hi,
    My users are complaining about the decimal point not being very clear when fractional numbers are shown. I need a format mask to show a leading zero for numbers between 0 and 1 (eg. 0.5) but not have a trailing point after whole integers.
    by example:
    10 should show "10"
    .5 should show "0.5"
    I have tried the following
    FM99990D99 which displays as
    10 as "10."
    .5 as "0.5"
    The whole integer of 10 then gets a trailing decimal point. Very ugly as the decimal is the exception to the rule which is why I need to highlight it.
    The user do not want a forced decimal place either as follows:
    FM999990D09
    10 as "10.0"
    0.5 as "0.5"
    The trailing decimal place is not a practical solution because 99% of numbers are whole numbers and the decimal just pollutes the screen with more zeros, making the numbers harder to read, resulting in more errors.
    I am looking for a format mask that shows:
    10 as "10"
    .5 as "0.5"
    I am using Oracle Forms which means I cannot set_item_instance_property for the records which have decimals. I need a single format mask for all options...
    Any help would be appreciated.
    Thanks,
    Tim.

    Thanks Francois.
    Looks like there is not a simple solution using a format mask alone.
    I have implemented a very similar solution to your suggestion. I have a character, non-base table field which I populate and dynamically set a format mask if the value is between -1 and 1 (and not zero).
    i.e.
    if :purchase.qty > -1 and
    :purchase.qty < 1 and
    :purchase.qty != 0
    then
    :purchase.qty__dsp := to_char(:purchase.qty,'FM999999990D99');
    else
    :purchase.qty__dsp := to_char(:purchase.qty);
    end if;
    Thanks,
    Tim.

  • Preserve leading zeroes?

    All,
    I created an interactive report, where one of the columns (type: string) periodically has data that "looks" numeric. That is, the column will contain six digits, like "123456" or "001233". The column displays fine--until we save the report as a CSV. The CSV file looks like this:
    "123456","other columns"...
    "001233","more data"...Excel, in its infinite "wisdom", sees the "001233" and decides that it's really a number--1,233. Which is horribly wrong, and rather annoying to me (and my users). If I go through the data import wizard, I can "force" Excel to see the column as text, but asking my users to remember to do that every time is going to be a losing battle. Is there any way around this?
    Thanks,
    -David

    have you looked at this article?
    What I would do myself is have it be tab delimited, not use double quotes around fields (or does apex do that?) and
    like they suggest, output a space in front of columns with leading zeros. But it all depends on what exactly you have in
    those columns e.g. if people managed to get carriage returns in them (boo! :-)
    PS I was using excel 2007).
    http://support.microsoft.com/kb/214233
    Avoiding Automatic Number Formatting
    If you want to type a value such as 10e5, 1 p, or 1-2, and you do not want the value to be converted to a built-in number format, type the number as a text value. To type a number as a text value, use any of the appropriate methods below.
    Method 1
    Place a space at the beginning of the entry.
    NOTE: This method does not work if the entry resembles a number formatted in scientific notation. For example, typing 1e9 results in a scientific number.
    Method 2
       1. Choose Format Cells
       2. Click the Number tab.
       3. Click Text, and then click OK.
    This method allows you to type data in the selected cells as text. You must perform these steps before you type the numbers in the cells.
    Method 3
    Precede the entry with an apostrophe. For example, type the following:
    '1 p

  • HP Prime - Suggestion: Leading zeros.

    Hopefully this is an appropriate place for this post.
    One of the most annoying aspects of the Prime is the way it strips off leading zeros from numbers.
    This results in "0.791" being displayed as ".791". To my mind, this is ugly and, as I said, annoying.
    So my suggestion is to add an option to force the leading "0" to always be displayed in this case.
    I assume this would be fairly easy to implement given that there are already a few other supported output formats.

    Hi,
    I suggest you place your request on this forum:
    http://www.hpmuseum.org/forum/forum-5.html
    Note: I do not work for HP, I just like playing with calculators :-)

  • SaveAsCSV() truncating leading zeros

    Hi
    We have used applet call saveAsCSV() and are experiencing the typical "leading zero" truncation since the value is being treated as numberic.
    I would like to know if there is any way of specifying certain fields as text other than inserting a character to force it to be a text field
    Thanks
    Deepa

    Hi Deepa
    This is actually a Microsoft Excel issue.  You cannot save a leading 0 in an csv file.
    I have tried doing this external to xMII and got to the conclusion that the file type CSV does not allow for leading zero's (I think this is the case with special characters in CSV files as well).
    Your best bet is to call a function to add leading zero's (something like a padding/stretch function) once you open the saved file.
    Regards

  • Adding leading zeros in abap objects.

    Can anyone explain me
    1. How to add leading zeros to a field in abap objects.
    For eg:
    data: dmb(6) type c value '123456',
    actually the output value of c should have leading zeros added to it for length 16.
    i.e '0000000000123456' . If the length of dmb is less than 16 then leading zeros should be added to that value to make it 16 as length.
    Please tell me how to do it in ABAP Objects.

    Hi Camila
    Try to use the statement
    DATA: ALPHABET(15) VALUE '     ABCDEFGHIJ',
          M1(4)        VALUE 'ABCD',
          M2(6)        VALUE 'BJJCA '.
    SHIFT ALPHABET LEFT DELETING LEADING M1.
    The field
    ALPHABET
    remains unchanged.
    SHIFT ALPHABET LEFT DELETING LEADING SPACE.
    The field ALPHABET now has the following contents:
    'ABCDEFGHIJ     '.
    SHIFT ALPHABET RIGHT DELETING TRAILING M2.
    <b>ALPHABET</b> now has the following contents:
    '      ABCDEFGHI'.
    <u><b>IN CHARACTER MODE</b></u>
    <b>Effect</b>
    This is the default setting (see above), and the addition is therefore optional.
    <b>Note
    Performance:</b>
    For performance reasons, you should avoid using SHIFT in WHILE loops.
    The runtime required to shift a field with length 10 by one character to the right or left requires about 5 msn (standardized microseconds). A cyclical shift requires around 7 msn. The runtime for the ...
    LEFT DELETING LEADING
    ... variant is around 3.5 msn, for ...
    RIGHT DELETING TRAILING
    ... around 4.5 msn.
    Reward all helpfull answers
    Regards
    Pavan

  • How do I use the print function to output a numeric variable with a fixed amount of leading zeroes

    I need to create an output from a T-SQL query that picks a numeric variable and uses the print function to output with leading zeroes if it is less than three characters long when converted to string.  For example if the variable is 12 the output should
    be 012 and if the variable is 3 the output should be 003.
    Presently the syntax I am using is PRINT STR(@CLUSTER,3) .  But if @CLUSTER which is numeric is less than three characters I get spaces in front.
    Please help!

    >> I need to create an output from a T-SQL query .. <<
    NO! NO! In RDBMS, we have a presentation layer that handles displays. We do not ever do it in the database. This is fundamental. But more than that, the purpose of PRINT is for debugging in T-SQL and never for output.
    You are still writing 1960's COBOL or BASIC, but you want to to it in SQL.  You probably picked the wrong data type (a numeric that should be a string) and are trying to repair your design error.  
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • IR - Column with leading Zeros issue

    Hello,
    I've got an IR report which includes as "default report settings" 1 column with leading 0s. In order to export to Excel that column as text rather than as a numeric I followed a workaround proposed before in this forum (excel copy drops leading zeros
    In essence this workaround is to create an identifical column but in "excel text format" and display the columns depending on the request value: INSTR(NVL(:REQUEST,'YABBADABBADO'),'CSV') <> 0 for example.
    This works just fine for the default report.
    The problem arise when a user creates his own customise report that includes the mentioned column and saves it as a named report. Here, when the results are exported to excel the "excel" column does not appear.
    In fact, just hiding one of the displayed columns produces the same undesired result.
    I would appreciate any comments or suggestions.
    Many thanks
    Edited by: Javier Gil on Jul 20, 2010 7:52 AM

    I have found a better method. In your IR query:
    SELECT LPAD(v.vendor, 7, ' ') vendor,
    /*Just LPAD to a length of the column defined in the database table or to 7, whichever is greater. */
    FROM v, r
    WHERE v.VENDOR = r.VENDOR
    AND date_rcv <= to_date(:P150_CUTOFF,'yyyy/mm/dd')
    AND inv_nbr = ' '
    AND to_stores <> 'T'
    AND (V.VENDOR = RPAD(:P150_VENDOR,10,' ') OR :P150_VENDOR = 'ALL')
    When you download to Excel by Download/XLS (Request=XLS), it preserves the leading zeros.
    In the case of dates, you should LPAD 10 minimum in this format.
    LPAD(to_char(date_rcv,'MM/DD/YY'), 10, ' ') date_rcv,
    I haven’t tried it yet but I think in the case of ‘MM/DD/YYYY’, you should LPAD 12 minimum in this format.
    LPAD(to_char(date_rcv,'MM/DD/YYYY'), 12, ' ') date_rcv,
    Drawbacks of this method:
    Since the string has leading white spaces, you cannot use the filter for the ‘=’ comparison operator. Even filtering using leading white spaces will not return anything. You must use the LIKE and NOT LIKE operator instead.
    Advantages of this method over the original one I posted yesterday:
    1)     You do not have to create another column for download, just one column will suffice.
    2)     Even though the query has leading white spaces, they will not display in the IR region.
    Edited by: richardlee on Aug 5, 2010 11:10 AM
    Edited by: richardlee on Aug 5, 2010 11:16 AM

Maybe you are looking for