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

Similar Messages

  • Preserve leading zeros in CSV file.

    Hello...
    I am creating a file on the fly and attaching with email.
    emp_no starts with 0001,0002,0003 ...etc.
    When file write emp_no to csv file...i looses leading
    zeros...what is best solution to preserve zeros?.
    In excel file creation, i am using
    style="mso-number-format:0000;" to preserve leading zeros.
    But by using cffile, i am not able to use style.....Is there
    any other way to preserve leading zeros?
    <cffile action="write" file="#dirname#/emp_mon.csv"
    output="List of Employees" addnewline="Yes">
    <cfoutput query="emp_q">
    <cffile action="append" file="#dirname#/#filename#"
    output="#emp_no#,#e_name#,#e_address#,#sal#" addnewline="Yes">
    </cfoutput>

    I'd suspect your CSV is fine, ie. if you open it in WordPad
    or NotePad you will see 0002. The problem is with whatever you're
    importing it into. Excel? If something else I don't know. If Excel,
    your Import spec, saved or on-the-fly needs to say Text on that
    field rather than the default General which simply means make a
    number (zero-suppressed) whenever possible. Single or Double quotes
    (on each field that needs it) are a workaround provided you specify
    them as "Text Qualifier", but you don't seem to want to do that, so
    Text is the only other method.

  • How to remove pound symbol # and preserve leading zeros in BEx Query

    Hi,
    I have two questions regarding the display in BEx Query.
    1. How can I remove the pound symbol # for blanks in BEx Query?
    2. How can I preserve leading zeros? At the moment, value "001" will be displayed as "1". But I need the leading zeros.
    Thanks.
    Joon

    Hi ,
    You can apply these settings in Bex query designer.
    If you need to remove pound symbol jsut make a new formula and use NODIM function you will find this function under data functions.
    So NODIM(Your price keyfigure) this will remove the Pound symbol.
    For # just find out against which  characterstic you are getting # then go to default values panel there you will find all your characterstic which you are using in report---Rt click -Restrict-single valuesdirect input-#-Move to selection(That forward arrow)--select that # and choose exclude from selection (That red square icon).
    And yes for leading zeros check out this thread
    Leading zeros not displaying
    Hope it helps you.
    Regards,
    AL
    Edited by: AL1112 on Jun 9, 2011 1:43 PM
    Edited by: AL1112 on Jun 9, 2011 1:47 PM

  • Cfspreadsheet how to preserve leading zeroes

    Is there a way to preserve leading zeroes in a field when displaying in excel other than adding a ' at the front of the field?  I have an id field defined in sql server as varchar but when creating an xls document using cfspreadsheet excel is interpreting the field as numeric and dropping the leading zeroes.  I cannot have the ' leading that field since it is imported into another system.

    This has been resolved.  I tested both suggested solutions.  I tried formatting the columns with spreadsheetformatcolumn as suggested in http://stackoverflow.com/questions/3081202/how-to-format-spreadsheet-c olumns-using-coldfusion but that did not preserve the leading zeroes in the ID column.  I then tried the solution with POI found here http://www.bennadel.com/projects/poi-utility.htm by Ben Nadel and that did preserve the leading zeroes.  Thanks for everyone's assistance and thanks to Ben for sharing his POI utility.
    - Julie

  • Preserve Leading Zeros in SQL export to TXT

    I need to export accounting data from SQL to a series of TXT files, with a "ServiceCode" of 02. I cannot get the
    leading zero to stick.
    Here is the section of the SQL stored procedure that pulls the serviceCode of “02.”
    IF @serviceCode =
    '02'
    BEGIN
    SELECT @total =
    COALESCE(SUM(Price),0),
    @itemCount = COALESCE(SUM(ItemCount),0)
    FROM #tblData
    WHERE CostCenter = @costCenter
    AND ServiceCode
    IN(SELECT
    DISTINCT [ServiceCode]
    FROM [DsPcDb].[dbo].[Service_T]
    WHERE [Name]
    NOT
    LIKE
    '%color%'
    AND [Name]
    NOT
    LIKE
    '%scan%'
    AND [Name]
    NOT
    LIKE
    '%fax%'
    AND [ServiceCode] <=
    196623)
    END
    ...and here is some text from the "02" output .txt file, with the leading zero stripped out of the third column:
    11/21/2014,00000-24057,2,1125
    11/21/2014,00001-MKTG12,2,150
    11/21/2014,40059-00395,2,62
    11/21/2014,40059-00409,2,32
    11/21/2014,40059-00428,2,12
    11/21/2014,40059-00432,2,2
    11/21/2014,40059-00434,2,218
    This won't let the receiving database import the data. ("02" is a specific code.) Three other txt files from this
    procedure are imported properly.
    Please help! Thanks!

    You need to cast the servicecode field to varchar to make sure it retains leading zero.
    So in your case make variable type varchar and also places where you select from field cast it to varchar.
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Excel copy drops leading zeros

    I have records with a part number that is a text field, but contains digits. When I export to excel, the excel spreadsheet drops leading zeros from the part number.
    How do I get the export to treat this as a text field and retain the zeros.
    No, I have no option to make this a number field.

    When the report is displayed on the screen initially for column "blah" the Conditional Display PL/SQL Expression "INSTR(NVL(:REQUEST,'YABBADABBADO'),'EXCEL') = 0" evaluates to TRUE because REQUEST does not have 'EXCEL' in it causing the value to display on the screen. For column "blah_excel" the Conditional Display PL/SQL Expression "INSTR(NVL(:REQUEST,'YABBADABBADO'),'EXCEL') != 0" evaluates to FALSE because REQUEST does not have 'EXCEL' in it causing "blah_excel" to not display.
    When the user clicks to download to CSV the page's REQUEST has 'EXCEL' in it. I think actual request value is 'FLOW_EXCEL'. For column "blah" the Conditional Display PL/SQL Expression "INSTR(NVL(:REQUEST,'YABBADABBADO'),'EXCEL') = 0" evaluates to FALSE because REQUEST has 'EXCEL' in it causing the value to not appear in the CSV. For column "blah_excel" the Conditional Display PL/SQL Expression "INSTR(NVL(:REQUEST,'YABBADABBADO'),'EXCEL') != 0" evaluates to TRUE because REQUEST does have 'EXCEL' in it causing "blah_excel" to appear in the CSV.
    http://mikerife.blogspot.com/2007/08/preserve-leading-zeros-in-apex-csv.html
    Mike

  • 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

  • Leading zeros from data downloads

    Hello!
    While downloading data from the ABAP tables, Excel removes the leading zeros automatically but in some SAP tables (NAST for example), those leading zeros are necessary to find the required associated data. Is there any way to prevent Excel from removing these zeros?
    Thanks a lot!

    Hi,
    There are two ways to solve it.
    1) select complete columns in the Excel sheet and then assign the number format as ' TEXT ' in the sheet.Then u ll be able to see the leading zero's
    2) If u donot want to wrk in Excel the way i have mentioned,then in the abap program just use the FM
    "CONVERSION_EXIT_ALPHA_INPUT" over that field before uploading in  a table.
    By mistake i have told u the wrong way.the first way is for copying the data from text file to excel file and preserving the leading zeros.
    regards
    kanishak
    Edited by: Kanishak Gupta on May 6, 2009 5:36 AM

  • Not to loose the leading zeroes

    Hi ,
    We are passing a data in table to the application server
    I have a variable zipcode in the table
    it is described as
    final_tab-zip   = p0006-pstlz(5).
    "zip is decalred as zip(5)
    Now I am passing the table as comma delimited file to application server.
    The problem is in the process..we are loosing the leading zeroes..
    if say zip is 08801..
    we see it as 8801...
    How can we preserve the leading zeroes when we transfer the data..
    Any change need to be done while decalration or transfer..
    Thank you.

    I am moving the field to the string and passing it to the file
    code is like this
    LOOP AT final_tab.
        DO.
          ASSIGN COMPONENT sy-index OF STRUCTURE pm_tab TO <fs>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          IF sy-index EQ 22.
            IF <fs> NE space.
              CONCATENATE string <fs> INTO string.
            ENDIF.
          ELSEIF sy-index EQ 1.
            IF <fs> EQ space.
              MOVE ',' TO string.
            ELSE.
              CONCATENATE string <fs> ',' INTO string.
            ENDIF.
          ELSE.
            IF <fs> EQ space.
              CONCATENATE string ',' INTO string.
            ELSE.
              CONCATENATE string <fs> ',' INTO string.
            ENDIF.
          ENDIF.
        ENDDO.
        APPEND string TO itab .
        CLEAR  string.
      ENDLOOP.
    Edited by: KUMAR BOJEDLA on Sep 5, 2008 11:10 AM

  • 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 truncating leading zeros in my popup window report

    Hello,
    I am using IR_columnname, for one of the columns in my report which is a popup window report.
    My problem is that IR_column search filter in my popup window is truncating the leading zeros.
    I am getting the value but it is truncating the leading zeros.
    like say if the deptno is something like 020 or 0020 in the parent window.
    the IR_columnname value is taking '20' (its truncating leading zeros) with this filter its not dispalying the result in my popup window.
    can anyone help me out with this.
    thanks.

    How are you passing values to the IR filter? There could be a possibility that you source logic is truncating the leading zeros.
    Thanks,
    Manish

  • How do I add leading zero(s) to exported files' names?

    I'm using Lightroom 1.4 on an iMac, with OS X 10.4. When I export a batch of photos, they get numbered automatically. For example, if they're pictures of my dog, I'll specify "Dog" as the name to be used and 1 as the starting number. Lightroom will then export them as "Dog-1.tif" and "Dog-2.tif" and so on.
    The problem is that when I then load these files into another application, it thinks that "Dog -1.tif" should be followed by "Dog-11.tif," then "Dog-12.tif," and so on to "Dog-19.tif" and then "Dog-2.tif," "Dog-20.tif," "Dog-21.tif," etc.
    One solution to this would be to have them numbered as 01, 02, 03. . . 09, 10, 11, etc. Rather than add those leading zeros to the file names manually, I'd like to have Lightroom put them in when it exports the files, but I can't figure out how to do that. I've tried entering 01 as the starting number in the "Export" dialogue box, but that doesn't do the trick.
    Can anybody tell me how to get Lightroom to add a leading zero (or zeros, when I export more than 99 files at a time) to the file names?

    >What if I just wanted to name the images 0001, 0002, 0003, etc? Can't seem to figure that out.
    In the Filename Template Editor, simply insert the [Sequence # (0001)] token as the only entry in the template field.

  • Remove the leading Zero from the Query output in SAP BW ?

    Hi
    Experts,
    Vendor Number loaded  as   (0000010076) from R/3 to SAP BW.
    How to remove  Prefix  of Zero for  the Vendor Number(0000010076)  from Quey outpt.
    Regards.
    ASIT

    Hi,
    Please check out this thread.
    Remove leading zeros
    Also check if there is any conversion routine used for that particular infoobject.
    If ALPHA conversion is selected for your infoobject then it will automatically take away the leading zeros at query level.
    Regards,
    AL
    Edited by: AL1112 on Sep 16, 2011 9:15 AM

  • How can we put the leading zeros for the extract file.

    hello experts..
           Iam extracting values from one ztable in this for one filed length will be 2, for this field i need leading zero s at the time of extract... please help me....

    Hi,
    Declare the field as NUMC data type, automatically you will get the leading zeroes.
    Regards,
    Subramanian

Maybe you are looking for

  • IOException: invalid content type for SOAP: TEXT/ using Sender SOAP adapter

    Hi all, When I am using Sender SOAP adapter, i am getting (MessagingException: Could not parse XMBMessage. Reason: java.io.IOException: invalid content type for SOAP: TEXT/HTML using connection SOAP_http://sap.com/xi/XI/System) exception. From my RWB

  • Reports: REP-0177 & REP-3000 errors :-( (RH 6.2.2 HA 1.0)

    Hi Folks, hi Oracle, we have some serious problems here with Oracle Reports 6i Patch 6 which is running under Red Hat HA (Red Hat 6.2.2 High Aviability Server 1.0, based on Zoot) Because HA installs without X i have installed all needed X-packes to g

  • Is there a cd slot on my new iMac

    IS THERE A SLOT TO PUT CD IN THE IMAC NEW COMPUTER

  • HP DV6 DV6184CA windows 7 laptop no sound from laptop speakers

    Yesterday I was having no issues, as all normal sounds were present (i.e. Windows start-up/shut-down, as well as able to hear mp3 music played on Media Player).  Then I accidently pressed the mute button and now I no longer hear sounds...advanced PC

  • Urgent help req

    Purchased MacAir book a month ago. On holiday remote location. Can't log in, don't think logged out correctly. Spining coloured wheel been going round for hours.