Cfselect with bind truncates leading zero

Banging my head against this one. I have two cfselect menus using bind. The first one populates the second. It's working fine except for this one wrinkle: the second select menu gets populated with zip codes. If they have leading zeroes (e.g. 02842) the zero gets clipped. The datatype in MySQL is char(5).
If I just throw a regular query on the data and dump it it comes back with the zeroes fine.
Bug? Workaround?
CF8 BTW.
Thanks.

Here is an example of related selects without using binds.  http://www.pathcom.com/~bracuk/code/RelatedSelects.htm
It may or may not be appropriate for your situation.  I remember something on these forums a few years back about performance problems if you used this approach with too much data.

Similar Messages

  • 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

  • Truncating Leading Zeros & Displaying Decimal Positions in a Webdynpro

    Hi All,
    I am new to webdynpro and assigned with some issues in webdynpro application, the issues goes like this. i  already have a webdynpro application where in i am trying to display a PO as in transaction ME23 with Header and Line Items, In Line Items, i want to Truncate Leading Zeros for material Number & Item Numbers. In the net price i want to display decimal values even if our price don’t have any decimal value. For Example if the net price is 33.33 then i am able to see the value as 33.33. If it’s 33.00 then i am able to see values only as 33. I want to see the exact value as 33.00. Let us know how to over come those issues. 
    Thanks in advance,
    With Best Regards,
    Prabahar N.R

    Hi Santhosh,
    I failed while executing the steps you mentioned, kindly look into below description for more understanding.
    We have an issue like the decimal positions are truncated when the value of decimal places are Zero. For Example if the net price is 99.98 then i am able to see the value as 99.98. If it’s 99.00 then i am able to see values only as 99. I want to see the exact value as 99.00. The values are populated from an RFC Table, which is coming from a Standard BAPI.  I find in the implementation, the attributes uses a method called bindText() available in com.sap.tc.webndypro.clientserver.uielip.standard.api.IWDtextview.  Below is the piece of code,
    com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView NetPrice_editor
    = (com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView)
    wdAlterEgo.createElement(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView.class, "Net_Price_editor");
    NetPrice_editor.setHAlign(com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDInputFieldAlignment.valueOf("left"));
    NetPrice_editor.setWrapping(true);
    NetPrice_editor.bindText("bapi_po_getdetail_input.Output.Po_Items.Net_Price");
    NetPrice.setTableCellEditor(_Net_Price_editor);
    Table.addColumn(Net_Price);
    I can see from R/3 back end the values coming with decimal values even if the decimal positions are null. Any suggestions will be very helpful.
    With Best Regards,
    Prabahar N.R

  • Truncating leading zeros for the data

    hi ,
      I am doing a conversion project from oracle source system(DB2) to BI system. I have a situation here:
      I am extracting material numbers from source system(DB2) into a ZXXXX characteristic and in the transfer structure i checked the conversion as well and for infoobject ZXXXX, i am using ALPHA conversion. but the data i get is truncating material numbers. For example, 050302 is coming as 50302 and truncating leading zero. I am not sure what needs to be done here.
    Please advise..
    Thanks in advance...

    Hi J Dorson,
    This is the expected bahaviour if your InfoObject is configured to have ALPHA conversion. If the zero's in front of the material number is needed, then turn-off ALPHA conversion in your InfoObject (e.g. by removing the conversion exit).

  • Download to EXCEL - Problem with truncating leading zeros

    Hello Experts
    I have Reqs-
    When i download data into EXCEL some of the fields like PERNR lets say if the valus of the PERNR is 01000032 then in the excel it is displaying it as 1000032 or esle if a DATE field with value 02/03/2007 (obtained by concatenating MM / DD / YYYY) it is displaying in the excel as 2/3/2007.
    I dont want the truncating of zeros to happen.
    Any INPUT will be rewarded with points.
    Thanks
    Vj

    Hi,
    Try to use this FM.
    There are two very important functional modules ,which are used to add zeroes(‘0’)  & Remove zeroes(‘0’)  from  numeric string input respectively.
    The functional module ‘CONVERSION_EXIT_ALPHA_INPUT’ comes handy in this situation.           
    Another functional module ‘CONVERSION_EXIT_ALPHA_OUTPUT’ is used to reverse the Operations performed by the above FM.
    Let us look up the first case.
    Function Module: CONVERSION_EXIT_ALPHA_INPUT
    PARAMETER:
    Importing Parameter: Input   of  type ‘C’
    Exporting Parameter: Output of type ‘C’.
    This function module is use to add zeroes (‘0’), to the left of the  numeric string input ,after making the input  numeric string right justified .
    If the input string is non-numeric (including alphanumeric) , string is stored as left justified ,with blanks towards the right.
    If the string is numeric say  vehicle number , vlcvehicle-vhcle( 10 char)
    INPUT  :  ‘123456’              
    OUTPUT : ‘0000123456’
    Whereas if string is non-numeric
    INPUT :    ’ABCD’              
    OUTPUT:  ‘ABCD’.
    Hope this will solve your problem.
    Regards
    Balaji

  • Truncating Leading Zeroes

    Hi,
    What is the best method to truncate the leading zeroes of an alphanumeric data item? Is there an expression editor function that could do this?
    I have come up with a logic involving 3 - 4 actions that could do this for a specific data item. The problem is I have got about 5 different data items in the same transaction that need leading zeroes truncated. Whats the best thing to do here?
    Do I need to build a custom action or expression editor function?
    Regards,
    V M.

    Well, there are equivilants in every database. I think Oracle has something like LTRIM(value, '0')
    If your application doesn't use any databases and you are on 12.0 + you could estabish a connection to the neweaver db.
    You could also look into and xsl solution using the XSL Transformation action.
    I often do this to create/format lists for query filters or similar tasks.
    For some background this issue often comes up when pulling data from standard SAP interfaces. In sap Order and Material numbers are typically trimmed automagically by the gui. But when pulling those data elements from sap you get the full monty. This is ok because you often need the full untrimmed value to use with other interfaces, but users still expect the values to be trimmed when displayed. There are a lot of solutions to this issue in regards to the front end (xsl, Javascript, SQL in cases where the data is stored/cached in a local database ) but it would be convienent to have this level of formatting built into the link editor. Maybe even something that accepts a regular expression?
    Regards,
    Christian

  • Procedure truncating leading zeros

    Hello,
    I'm setting up sequences for my sample database, in my design I have my ID columns in this format Staff: S110001, Parents: P110001 etc.
    When I try to implement this in a sequence like:
    create sequence Pnt_seq1 start with 0001;
    insert into parents
    (parent_id, f_name, m_init, l_name, house_n, street, city, postcode)
    values
    (('P' || to_char(sysdate, 'yy')|| Pnt_seq1.nextval), 'Jim', 'I', 'Brown', 34, 'Barker St', 'Wrexham', 'LL11 8UH');
    It trims or truncates the leading zeros giving me P111 instead of P110001. Is there a way around this or am I better off changing my domain definitions/schema to start at P111001 or something?
    Thanks a lot
    Mike

    A sequence is always numeric, so leading zeros have no place
    Nothing is trimmed.
    If you want leading zeros in the code you posted use
    to_char(Pnt_seq1.nextval,'fm0009')
    Sybrand Bakker
    Senior Oracle DBA

  • Coldfusion json truncates leading zeroes

    Hi All -
    I am using jquery jqgrid with Coldfusion. I have a cfc whose return format is JSON. I have a database column of type varchar, but it returns values which starts with zeroes. On displaying data, the leading zeroes are truncated. I verified in firebug, the JSON response itself is cutting off the leading zeroes.
    Any suggestions or thoughts on this?

    If you are using CF 9.0 there was a documented bug that has been fixed in Adobe® ColdFusion® 9.0 Update 1:
    ID
    Area
    Bug Description
    82706
    AJAX Plumbing
    When you use  serializeJSON or   deserializeJSON, data type conversion occurs  automatically. For example,   000001 is converted to numeric 1.
    I know that there are new bugs introduced with Updater 1 so it would probably be wise to get the ColdFusion 9.0.1 Cumulative Hot Fix 1 also. As always, test the updates before using in production.

  • 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

  • Grid Download to Excel truncates leading zeros

    We are on tools 8.51. The download feature for a Grid now removes the leading zeros when the grid is downloaded to excel. Has anyone found a way to fix this issue ? Thanks in advance

    When you download from PS query, the output is created as a true binary xls file, but when you download from a grid in PT 8.51 the output file is html, even though the filename is ps.xls. You can open this file in a text editor.
    If you have all numeric data in a column, it will be stored as <td>nnnnnn</td> in the html file. if the column has mixed numeric and text data, it will be stored as <td>=&amp;quot;nnnnnn&amp;quot;</td>. The leading zeroes are still there in both cases, but when excel imports the first form it will convert the result to numeric, the second it will treat as text.
    Other than logging a case with Oracle, the only workaround I could think of would be to save the file to disk and run the macro directly against the html. Of course, this would likely be a major redesign.
    Regards,
    Bob

  • Truncate leading zeros

    Hi,
        How to truncate the leading zeros of a field?
        e.g:  if the value is '000000000080004040', it should like '80004040'.

    Hi
    pls use the fm CONVERSION_EXIT
    like
    Use this code for adding leading zeros for a particular field.
    i have used for p_kunnr to suppress zeros replace and use ur variable
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = p_kunnr
    IMPORTING
    OUTPUT = p_kunnr.
    Use this code for removing leading zeros for a particular field.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
    input = p_kunnr
    IMPORTING
    OUTPUT = p_kunnr.
    regards
    sathish

  • HOW TO TRUNCATE LEADING ZEROS  [ URGENT ]

    A PROGRAM TO GET THE LENGTH OF THE SRVPOS [ SERVICE NUMBER]
    BUT IN OUTPUT IT IS GIVING 12 LEADING ZEROS WHAT SHALL I DO TO REMOVE LEADING ZEROS AND TO GET THE LENGTH OF  THE SRVPOS [ SERVICE NUMBER] AFTER REMOVING LEADING ZEROS
    TABLES: ESLL.
    DATA: BEGIN OF IT OCCURS 0,
          SRVPOS LIKE ESLL-SRVPOS,
          END OF IT.
    DATA:LEN TYPE I VALUE 0,
         IT1 TYPE I,
         IT2 TYPE C VALUE 0,
         N(15) VALUE'1000000000000'.
    SELECT SRVPOS INTO IT FROM ESLL .
           IT1 = IT MOD N.
           IT2 = IT1.
           LEN = STRLEN( IT2 ).
           WRITE: / LEN,IT2.
    ENDSELECT.

    Hi Shailendra
    We can use SHIFT LEFT command in this case.
    Eg: SHIFT LEFT <var> DELETING LEADING '0'.
    or FM: CONVERSION_EXIT_ALPHA_INPUT
    data: var(10) type c value '0000000123'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        INPUT         = var
    IMPORTING
       OUTPUT        = var.
    Kind Regards
    Eswar
    Message was edited by:
            Eswar Rao Boddeti
    Message was edited by:
            Eswar Rao Boddeti

  • cfselect with bind to cfc works but is followed by 500 Jrun javax.servlet.ServletException

    All;
    This is driving me crazy. 
    I have a CFC with a function that returns countries via remote as JSON with the // prefix as Cold Fusion is configured.
    I call it with the following url
    www.mydomain.com/getCountriesAndStates.cfc?method=getCountries&returnFormat=json&argumentC ollection={}&_cf_nodebug=true&_cf_nocache=true
    It returns countries according to the Cold Fusion specs (just imagine it returning all countries, didn't want to paste it all the countries here).
    //[[0.0,"Please select a country..."],["US","UNITED STATES"],["CA","CANADA"]] 
    I bind a <cfselect for countrycode to this CFC and it works about 30% of the time.
    Here is the <cfselect
    <cfselect name="CountryCode" id="spanCountryCode" bind="cfc:getCountriesAndStates.getCountries()" bindonload="true"  onChange="DEdetermineTohide(this.id, '1')" onKeyUp="DEdetermineTohide(this.id, '1')">   
            </cfselect>
    It has a second function that returns the States with a CountryCode as the argument. 
    I call it with the follow url
    /getCountriesAndStates.cfc?method=getStateProvince&returnFormat=json&argumentCollection={" countrycode":"US"}&_cf_nodebug=true&_cf_nocache=true
    It returns states according to the old Fusion specs (just imagine it returning all the states, didn't want to paste all the states here.)
    //[[0.0,"Please select a state..."],["AL","ALABAMA"],["AK","ALASKA"]]
    I bind a <cfselect to this CFC with the countrycode as an argument and it populates the states for the countrycoe about 30% of the time.  It fails when the getCountries call fails.
    Here is the State <cfselect
    <cfselect name="StateCode" bind="cfc:getCountriesAndStates.getStateProvince({CountryCode})">
            </cfselect>
    I have a third funtion that returns whether or not the country selected has States and Zip Codes.  I call this function from a seperate javascript script included in the header and fired from the <cfselect name="CountryCode for onChange or onKeyUp.  It basically determines whether or not to show or hide both the State or Zip span but calls the CFC so that I can encapsulate everything in one place.  So the state and zip span with <cfselect and <cfinput appear and disappear based on the information about the country and state and the labels can change too from State to Province and from Zip to Postal Code etc...
    /getCountriesAndStates.cfc?method=getStateZipMetaData&returnFormat=json&argumentCollection ={"countrycode":"US"}&_cf_nodebug=true&_cf_nocache=true
    Ok, so I hope I have described enough about what I am doing.  This works about 30% of the time and fails about 70% of the time.  Flawlessly.  Sometimes it works for hours.  But eventually for some reason AFTER a perfectly good JSON response is returned from Cold Fusion, the Cold Fusion server starts following the JSON response with a 500 Serverlet Exception error.  This happesn on all function calls until I reboot my machine.
    It is driving me mad and making me start to reconsider whether or not I want to use CFForm binding.  It seems like a nice elegant solution that really simplifies and reduces the amount of javascript I have to write, but I can't go to production with forms that produce 500 server errors.
    Anyone have any ideas on what is going on?  If this is a bug?
    Should I just stay away from <cfform binding?
    Please help because it is driving me really crazy.
    My platform information is below.
    About 70% of the time it returns all the countries followed by a 500 Servlet Exception error.
    500
    javax.servlet.ServletException
         at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:154)
         at coldfusion.xml.rpc.CFCServlet.doGet(CFCServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
         at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
         at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
         at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
         at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
         at jrun.servlet.FilterChain.service(FilterChain.java:101)
         at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
         at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
         at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
         at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
         at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
         at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
         at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
         at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
         at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    Platform details
    Server Product
    ColdFusion
    Version
    9,0,0,251028 
    Edition
    Developer 
    Operating System
    Windows XP 
    OS Version
    5.1 
    Adobe Driver Version
    4.0 (Build 0005) 
    JVM Details
    Java Version
    1.6.0_14 
    Java Vendor
    Sun Microsystems Inc. 
    Java Vendor URL
    http://java.sun.com/ 
    Java Home
    C:\ColdFusion9\runtime\jre 
    CF9 Update 1
    Apache 2.2
    Database MS-SQL Express

    Ok, so I think I answered this for myself.  This may be ignorant.  Whatever.  I haven't programmed CF in over 10 years and just started again a month ago, so I think advanced CFC and javascript is a lot.
    I seperated my CFC into a directory with a Alias mapping under Apache and a CF Mapping from CFIDE
    I trimmed down the application.cfc
    It was
    <cfset This.clientstorage="Cookie">
    That was causing the remoting CFC's to return a 500 Jrun Servlet Error
    I am just going to keep my remote CFC's seperate from the rest of my application anyway because they need a different type of security schema.
    So, if anyone struggles with this.  I recommend just put your remotely accessd CFC's in a seperate virtual directory mapped from your webserver and CF and lock them down both with a trimmed down application.cfc and some kind of security.
    They also seem to run much faster now combined with my other Ajax and Javascript.

  • Truncation of leading zero's for a numeric field

    How to truncate leading zeros for numeric key figure field. The field value shows 0.0000000000000000E+00. Why the value shows like this??? Plz explain.
    Draj S

    Hi,
    I guess the Infoobj is FLOATING POINT. So its displaying that way.

  • Leading zeros in downloaded excel

    Hi,
    I'm facing a problem with truncated leading zeros in downloaded excel. Can anybody suggest me how to get those leading zeros in excel.
    I tried Function modules XXL_FULL_API and WS_DOWNLOAD, both did not work.
    Regards,
    Praveena

    Hi Praveena,
    check the following code.
    data : begin of itab occurs 0,
             matnr  like mara-matnr,
             maktx  like makt-maktx,
             matnr2 like mara-matnr,
           end of itab.
    itab-matnr  = '00000011111'.
    itab-maktx  = 'test1'.
    itab-matnr2 = '00000011112'.
    append itab.
    itab-matnr  = '00000033333'.
    itab-maktx  = 'test2'.
    itab-matnr2 = '00000044444'.
    append itab.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
        FILENAME                      = 'D:\c.xls '
        FILETYPE                      = 'WK1'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        data_tab                      = itab
      FIELDNAMES                    =
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      NO_AUTHORITY                  = 10
      OTHERS                        = 11
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    nagaraj

Maybe you are looking for