DateFormat function inserts space in front !

Hi to all,
I recently started a brand new project in CF9.0.1 (hotfix 1 in place).
In one of my main components I have a function as per the following :
    <cffunction name="DateFormatBE"
                     access="public"
                     returntype="string"
                     description="Formats a given string to Belgian date format, returns a blanco when no date is given">
        <cfargument name="myDate"
                           type="string"
                          required="false"
                          default=""
                          hint="the string to date format">
       <cfscript>
            if (Len(Trim(ARGUMENTS.myDate))) {
                if (! IsDate(ARGUMENTS.myDate)) {
                    ARGUMENTS.myDate = ParseDateBE(ARGUMENTS.myDate);
                    if (! Len(Trim(ARGUMENTS.myDate)))
                        return "";
                return Trim(LSDateFormat(ARGUMENTS.myDate,"DD/MM/YYYY"));
            } else
                return "";
        </cfscript>
    </cffunction>
    <cffunction name="ParseDateBE"
                    returntype="any"
                    access="public"
                    output="false"
                    hint="Parses a given string to a date object (dd/mm/yyyy).">
        <cfargument name="myDate"
                            required="No"
                            type="string"
                            default=""
                            hint="the string to parse of format (dd/mm/yyyy)">
        <cfscript>
            if (ListLen(ARGUMENTS.myDate,"/") == 3) // expects two slashes
                return CreateDate(ListGetAt(ARGUMENTS.myDate,3,"/"), ListGetAt(ARGUMENTS.myDate,2,"/"),ListGetAt(ARGUMENTS.myDate,1,"/"));
            else
                return "";
        </cfscript>
    </cffunction>
As of version 9.0.1 I always receive an extra space in front if I output a date as following :
     <cfoutput>
          <input type="Text"
                    name="SomeName"
                    value="#DateFormatBE(Now())#" >
     </cfoutput>
However, this does seem to work as expected :
     <cfdump var="#DateFormatBE(Now())#">
Is this a known bug or am I missing something?
Thanks for reading!
Bert.

I do have put output="false" in my component tag definition, but that seems to do just nothing...
When one instantiates a CFC, any code outside any <cffunction> within the CFC file is executed.  That could generate spurious whitespace if you don't have OUTPUT="FALSE" on the CFCOMPONENT tag.
Adam

Similar Messages

  • How to insert spaces in elements in message mapping

    Hi All,
             I have scenario, where in the incoming data is put into a file, but if there is no incoming data for any element it should insert spaces equivalent to the lenght of the field. how can this be done?
    XIer

    Xier,
    your problem is that the MapWithDefault function will fill only the fields which have no value, for example, if that tag is like <field2/>. When you have <field2></field2>, you have a value, even though this value is an empty string.
    To test your scenario properly, change your input xml to:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Countresult xmlns:ns0="urn:sce.com:xi:FI:TestProjectStructureUpload">
         <record>
              <field1>a</field1>
              <field2/>
              <field3>b</field3>
         </record>
    </ns0:MT_Countresult>
    If your requirement is to insert spaces when you have empty string as the input (<field2></field2> case), then you can't use MapWithDefault. In this case, you have to use an if logic: if input = "" (empty string) then output = "    " (4 blankspaces), else output = input.
    If you don't know how the input will come, best scenario would be to combine the MapWithDefault + If logic, in order to solve both cases (no input or empty string input).
    Regards,
    Henrique.

  • Use of DateFormat function influences headers

    Can someone confirm/deny this, I must be going crazy....
    In the attached code, I set the content type to text/xml. But
    when I visit the page in a browser it is resturned as text/html..
    The header looks like this:
    quote:
    HTTP/1.1 200 OK
    Connection: close
    Date: Mon, 05 Feb 2007 17:40:06 GMT
    Server: Microsoft-IIS/6.0
    Expires: Mon, 05 Feb 2007 17:40:06 GMT
    Content-Language: en-AU
    Content-Type: text/html; charset=UTF-8
    Cache-Control: no-cache
    When I remove the call to the dateformat function, or if I
    change dateformat into lsdateformat, everything works properly:
    quote:
    HTTP/1.1 200 OK
    Connection: close
    Date: Mon, 05 Feb 2007 17:41:30 GMT
    Server: Microsoft-IIS/6.0
    Expires: Mon, 05 Feb 2007 17:41:30 GMT
    Content-Type: text/xml; charset=utf-8
    Cache-Control: no-cache
    What am I missing here? Is this a bug or a "feaure"?
    Environment: Coldfusion MX 7,0,2,142559, JVM 1.4.2_09-b05,
    IIS 6, Windows 2003 Server Standard SP1.
    Code attached:

    Thanks all for confirming and for the suggestions. Bug report
    has been raised, with a reference to this forum thread.
    Putting <cfcontent type="text/xml; charset=utf-8"> in
    front of each area in my original file where xml output is
    generated works (without the charset specified it changes the
    encoding unfortunately) so for now I will have to stick those in.
    @Michael: if you can point out where I have used a
    processingdirective in the wrong place in my sample code, please
    speak up
    I do hope Macromedia/Adobe will fix this bug, because someone
    is bound to forget to put that extra cfcontent tag in, or use
    dateformat in the wrong place.
    - Rutger

  • How to get value in function insert table test ?

    Hi
    I use function insert table test in order to get value in table for use in code page but i don't know how to get value in table.If somebody have any idea.Please give me some advice.
    Thank you,
    Waruja

    You will need to grab the contents with VBA
    Table test is user interface only.
    This thread may help
    http://qazone.empirix.com/thread.jspa?threadID=748&tstart=0

  • "Connect to server" inserts "afp://" in front of "vnc://"? 10.4.11

    Hi All: I have a macbook running 10.4.11 connecting to the internet through a wireless router. I'm trying to connect to a vnc server in a remote location. When I go to "connect to server" and enter:
    vnc://[ip address]
    the "connecting to server" window pops up, but I see in there "connecting to afp://vnc//[ip address]"
    where it seems to be inserting "afp://" in front of what I entered, and stripping out the colon after "vnc"
    What am I doing wrong?

    Hi BD: I'm not sure I understand all your questions...let me clarify the topology.
    The system I'm trying to connect to has a VNC server running on it and is accessible through a public IP. I'm trying to connect to that system across the 'net from my laptop. I don't have access to that system, but their IT guy assures me people are able to connect to it remotely and screen share.
    Also, I'm able to connect to the remote computer using AFP...it's just VNC that's not connecting.
    My laptop is on a local subnet connecting through a WAP that connects to a DSL router. I have not configured any special PAT or forwarding on my end that would be messing with an outgoing VNC connection. Again, I'm trying to connect as a client to a remote VNC server so I can share the screen of the server (I'm pretty sure the "server" is just a Mac with sharing enabled).

  • More than one blank Insert Space?  How do you add more?

    Hello. I was curious how to add more blank insert spaces. Reason being that I want my Autoload to have 7 per track and that would give me room to throw an insert in the middle of the chain and then add more DSP Effects before or after the first one. Is there a way without making a dummy track for inserts and leaving one in like position 6 in the chain? Thanks guys!

    Well, they just adapt. So a dummy will do, just put a gain in there or something.

  • Is is possible to remove space in front of bulletButton?

    Hi all,
    Is it possible to remove the space in front of a bulletButton (RichTextEditor)?
    By that I mean the space in front of
    <- this.
    So that the bullet is totally aligned left.
    Thnx,

    Hi Malla,
    To my knowledge, this is not possible. You can hide/show the entire toolbar. But not a specific item for security reasons.
    Check out the following link
    http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=7845
    Regards,
    Mathan

  • Big space in front of hyperlinks.

    Everywhere I have a hyperlink in the html files, javahelp puts a big space in front of it. This leaves big gaps in a sentence that has a word that is a hyperlink.
    Any idea what causes this? Or any way to prevent it?

    It looks a lot different on different platforms.
    On SGI it looks really bad.
    http://www.kennyboy.org/sgi.jpg
    On Linux better.
    http://www.kennyboy.org/linux.jpg
    On windows it looks the best.
    http://www.kennyboy.org/windows.jpg
    Why does it look this different on the three different machines?

  • Adobe inserts spaces instead of letters during editing

    When I try editing a PDF I created in Adobe, it inserts spaces in place of certain letters.  Any guidance to overcome this? 

    Essentially it’s this.  I had a misspelled word and needed to replace an uppercase B with an uppercase V. I tried deleting the B first and inserting the V, then tried highlighting the B and overwriting with V, and finally tried inserting the V after the B with the idea of just backspacing over the B afterwards.
    Interestingly, the document lets me insert a lowercase v, but not an uppercase V.

  • Inserting Spaces into code when pressing tab

    When I press the tab key, DW inserts a tab character in the
    code. I'd like to replace that behavior with it inserting spaces.
    DW catches when you don't add a trailing slash on certain HTML tags
    in XHTML, so is there a way to hook into that system and have it
    catch when you type a tab in?
    The code formatting preferences only apply to when DW
    auto-inserts tabs, not manually pressing the tab key.

    Go to Edit>Preferences>Code Format and ensure that the
    first setting is as follows:
    index (box checked) with "2" spaces (not tabs)

  • How can I stop Dreamweaver from inserting spaces after variables?

    How can I stop Dreamweaver from inserting spaces after
    variables?
    Example:
    "...write to you@<!--#echo var="uu" --> and ..."
    is changed by DreamWeaver to
    "...write to you@
    <!--#echo var="uu" -->
    and...>
    When saving or doing other editing, DreamWeaver adds a space
    and a line break before and after the variable. The line break
    isn't hard and doesn't show, but the spaces added before and after
    the variable DO show in browsers. That looks rather stupid and
    incompetent, and requires hand editing on the server after
    uploading.
    Line wrap and code formatting are turned off.
    Is manual correction after uploading the only solution to
    this problem?
    Thanks
    DearWebby

    DearWebby,
    We already discussed this offline, but I want to post the fix
    here for
    the sake of posterity:
    1. Edit > Tag Libraries…
    2. Open HTML Tags folder
    3. Select "directive" folder icon (not really a folder)
    4. Change Line breaks: setting to "No line breaks"
    5. Click OK
    HTH,
    Randy
    > How can I stop Dreamweaver from inserting spaces after
    variables?
    >
    > Example:
    > "...write to you@<!--#echo var="uu" --> and ..."
    > is changed by DreamWeaver to
    > "...write to you@
    > <!--#echo var="uu" -->
    > and...>
    >
    > When saving or doing other editing, DreamWeaver adds a
    space and a line break
    > before and after the variable. The line break isn't hard
    and doesn't show, but
    > the spaces added before and after the variable DO show
    in browsers. That looks
    > rather stupid and incompetent, and requires hand editing
    on the server after
    > uploading.
    >
    > Line wrap and code formatting are turned off.

  • Spaces in front of form entry values

    I have a form that submits to itself. After submiting the
    form, and if there is a user error, the form entry values are
    brought back with a space in front of the value. For example the
    first three digits of a ssn number bring back a space + 428.
    Is there a way to keep the values from coming back with a
    space in front?

    I am not using many udf. Sample of form entry code below:
    <input name="ssn1" type="text" id="ssn1" <cfif
    isdefined("form.ssn1")> value = "<cfoutput>
    #form.ssn1#</cfoutput>" <cfelse> value =
    "<cfoutput>***</cfoutput>"</cfif> onKeyUp
    ="validotherssn(this);" size="3" maxlength="3" align="left"
    onKeypress="if (event.keyCode < 48 || event.keyCode > 57 )
    event.returnValue = false;" >
    <input name="ssn2" type="text" id="ssn2" <cfif
    isdefined("form.ssn2")>value = "<cfoutput>
    #form.ssn2#</cfoutput>"<cfelse> value =
    "<cfoutput>**</cfoutput>" </cfif>
    size="2" maxlength="2" onkeyup="validotherssn(this);"
    onKeypress="if (event.keyCode < 48 || event.keyCode > 57 )
    event.returnValue = false;" >
    <input name="ssn3" type="text" id="ssn3" <cfif
    isdefined("form.ssn3")>value = "<cfoutput>
    #form.ssn3#</cfoutput>" <cfelse> value =
    "<cfoutput>****</cfoutput>"</cfif>
    onKeyUp="validotherssn(this);" size="4" maxlength="4"
    onKeypress="if (event.keyCode < 48 || event.keyCode > 57 )
    event.returnValue = false;" > </td>

  • BufferedReader Problem (inserting space after every character)

    (This is a message I sent to an Aglet forum, however I thought maybe someone here could help me with the BufferedReader problem...with the spacing...read below)
    -Blake
    ok here's what I'm attempting to do.
    I have a Master Aglet that creates a slave which is dispatched to a remote site. The Slave then opens a log file, reads it, and then is supposed to read the file line by line and send each line as a message back to the Master. As the master receives each line it appends the line to the window it created earlier.
    I don't know what the problem is...it won't display the log file in the master window.
    It does display each line on the console window.I added a println() function to make sure the String array was getting the information. There is a small problem with that as well because it inserts a space after EVERY character (BufferedReader problem??)...what is up with that? for example:
    If the log file looked like: This is a log file entry.
    the console looks like this when it is printed: T h i s i s a l o g f i l e e n t r y .
    .... I had done something in a similiar program...and it worked just fine. here's some source code:
    <b>Master:</b>
    else if (msg.sameKind("Log")) {
    try {
    //println for testing purposes
    System.out.println(msg.getArg());
    appendMessage(" " + msg.getArg() + "test \n");
    } catch (Exception e) {
    System.out.println(e.toString());
    <b>Slave: </b>
    File log = new File("C:\\Aglets2.0.2\\public\\WINDOWSUPDATE.log");
    FileReader fr = null;
    try{
    fr = new FileReader(log);
    } catch (FileNotFoundException e) {
    System.out.println(e);
    BufferedReader br = new BufferedReader(fr);
    //Get filename of log
    try {
    Message msg = new Message("FileName", log.getName());
    mProxy.sendOnewayMessage(msg);
    } catch (InvalidAgletException iae) {
    System.out.println(iae.toString());
    } catch (Exception e) {
    System.out.println(e.toString());
    //read each line of file and send back to Master as a message
    try{
    int i = 0;
    while ((s = br.readLine()) != null) {
    i++;
    count = i;
    for (int j = 0; j < count; j++)
    System.out.println(s[j]);
    //send message back to Master Aglet with log file information
    try {
    Message msg = new Message("Log", s[j]);
    mProxy.sendMessage(msg);
    } catch (InvalidAgletException iae) {
    System.out.println(iae.toString());
    } catch (Exception e) {
    System.out.println(e.toString());
    //close file reader
    fr.close();
    } catch (IOException e) {
    System.out.println(e.toString());
    }

    actually i did declare s, you just don't see it there because i only posted some of the code....
    I fixed the "spacey" problem by using a FileInputStream instead of a bufferedreader....
    like this (i'll post the whole code here:
    public class Slave extends BlindAglet {
        AgletProxy mProxy = null;
        boolean back = false;
            char[] c = new char[1000];
        BufferedReader br = null;
        int count;
        // Do some tasks when the aglet is created
        public void onCreation(Object init) {
            // Must make a note of the master here
            mProxy = (AgletProxy)init;       
            // Add our own listener and adapter
            addMobilityListener(
                new MobilityAdapter() {
                    // Using this as a safety check in case we get caught in a loop in the same host
                    public void onArrival(MobilityEvent event) {                   
                        try {
                            mProxy.sendMessage(new Message("NewSlaveProxy", getAgletContext().getAgletProxy(getAgletID())));                                                            
                        } catch (InvalidAgletException iae) {
                            System.out.println(iae);
                        } catch (NotHandledException ex) {
                            System.out.println(ex);
                        } catch (MessageException ex) {
                            System.out.println(ex);
                        //Are we back to origin?
                            if(back) {         
                                 back = false;     
                                try{
                                     FileWriter fw = new FileWriter("test.txt");                                                                  
                                 for (int i = 0; i < count; i += 2){ 
                                           fw.write(c);
                             fw.close();
                        } catch (IOException e) {
                                  System.out.println(e);
                                  dispose();
                             dispose();
    ); /* End of Adapter */
    public void run() {
         // Are we at home base?
    if (atHome()) {
    try {
    dispatch(new URL("atp://darklord:4434"));
    } catch (Exception e) {
    System.out.println(e.toString());
         try{
         File log = new File("C:\\Aglets2.0.2\\public\\WINDOWSUPDATE.log");
         FileInputStream f0 = new FileInputStream(log);
    //Get filename of log
    try {
         System.out.println(log.getName());
    Message msg = new Message("FileName", log.getName());
    mProxy.sendOnewayMessage(msg);
    } catch (InvalidAgletException iae) {
    System.out.println(iae.toString());
    } catch (Exception e) {
    System.out.println(e.toString());
              //read each line of file and send back to Master as a message
              try{               
         int size = f0.available();
         int i = 0;
         for (i = 0; i < size; i++) {
              c[i] = (char) f0.read();
    //send message back to Master Aglet with log file information
                             try {
                        Message msg = new Message("Log", c[i]);
                        mProxy.sendOnewayMessage(msg);
              } catch (InvalidAgletException iae) {
                             System.out.println(iae.toString());
                        } catch (Exception e) {
                             System.out.println(e.toString());
    count = i;
              } catch (IOException e) {
                   System.out.println(e.toString());
                   } catch (FileNotFoundException e) {
                   System.out.println(e);
         back = true;      
         returnHome();
    * Returns true if the current host is our origin
    public boolean atHome() {
    if (getAgletInfo().getOrigin().equals(getAgletContext().getHostingURL().toString()))
    return true;
    else
    return false;
    * Allows a slave to contact it's master and ask for a retraction.
    public void returnHome() {
    try {
    Message msg = new Message("RetractMe");
    msg.setArg("url", getAgletContext().getHostingURL());
    msg.setArg("id", getAgletID());
    mProxy.sendOnewayMessage(msg);
    } catch (InvalidAgletException iae) {
    System.out.println(iae.toString());
    } catch (Exception e) {
    System.out.println(e.toString());
    * Return a reference to our Master's proxy
    public AgletProxy getMasterProxy() {
    return mProxy;
    } /* End of Class

  • Robohelp randomly inserts spaces in lists

    Hi all,
    I have the problem that Robohelp randomly inserts non-breaking spaces in some list entries (not all, about 50%), after the bullet and before the first character of the text. I have tried the options such as ignore numbering and mapping to a paragraph style without success. I read through various threads about lists but have not encountered this problem so far. Any ideas? The concerned list entries look fine in Framemaker.
    Besides that I noticed that if a table follows a list then Robohelp wraps the table up into the last list item (overlapping, very ugly) and places an additional empty list entry behind the table. Also when importing lists (and even when selecting the Convert-to-HTML option) I see no way to map the list style to a HTML list style in Robohelp, only paragraph styles appear. It seems that for importing from Framemaker the entire list functionality has not been implemented very cleanly..

    We did a lot of testing and the problem of random spaces at the begin of list entries always pops up. Can anybody confirm this bug, or does this problem not appear in your projects? We need to narrow the problem down to Robohelp or perhaps some particular setting of our Framemaker styles.

  • Insert space between records from open .. close dataset

    I am generating a file that contains different information for a business partner with the aid of datasets. I want my records to look like this ...
    partner1 BPname1 address1 contact info1   - from table1
    partner2 BPname2 address2 contact info2
    partner1 agency1 address1 insurance obj1  - from table2
    partner2 agency2 address2 insurance obj2
    But the one I am seeing in the generated file in AL11 is like this ...
    partner1 BPname1 address1 contact info1
    partner2 BPname2 address2 contact info2
    partner1 agency1 address1
    partner2 agency2 address2
    I want to see a space between records from tables 1 and 2.
    Code:
    OPEN DATASET FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
    IF SUBRC = 0
       LOOP AT TABLE1
         TRANSFER TABLE1 TO FILE
       ENDLOOP
       CLOSE DATASET
       OPEN DATASET FILE APPENDING
       IF SUBRC = 0
         TRANSFER TABLE2 TO FILE
       ELSE
         MESSAGE ERROR
       ENDIF
    ELSE
       MESSAGE ERROR
    ENDIF
    CLOSE DATASET
    Thanks.

    Hi Cor,
    Here is my code to create datagridview (see below)
    By the way, I would like to ask if i will always declare this code every time i will do the insert , update and delete records. Let say i have separate buttons for every process. its possible to create one time and i will call this function.
    Another question. can i put a auto number in the first column of Datagridview upon adding of records.
    Dim conn As New System.Data.OleDb.OleDbConnection() conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\jov\Desktop\FeedBackSystem\FBSystems\FBSystems\Data\KPI.accdb"
    form load event (DataGridView)
        Dim dt As New DataTable        Private cma As CurrencyManager = DirectCast(BindingContext(dt), CurrencyManager)        'Set Data GridView
            With dgvReport            dt.Columns.Add("ItemNumber", GetType(String))            dt.Columns.Add("ReportName", GetType(String))            dt.Columns.Add("Ratings", GetType(String))            dt.Columns.Add("Comment", GetType(String))            AddHandler cma.CurrentChanged, AddressOf CurrentChanged            .ReadOnly = True
                .MultiSelect = False
                .AllowUserToAddRows = False
                .AllowUserToDeleteRows = False
                dgvReport.DataSource = dt            For Each c As DataGridViewColumn In dgvReport.Columns                c.Width = 200            Next
            End With
    This is the code to insert records from textbox to datagridview
    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
    Dim i As Integer
    dt.Rows.Add(txtItemNo.Text, CmbReportName.Text, CmbRate.Text, txtComment.Text)
    End Sub

Maybe you are looking for

  • Suddenly ODI scheduled executions taking more time than usual.

    Hi, I have set ODI packages scheduled for execution. From some days those are taking more time to execute themselves. Before they used to take 1 hr 30 mins approx. Now they are taking 3 - 3 hr 15 mins approx. And there no any major change in data in

  • Oracle 9i/10g - Parses/Invalidations

    Hello guys, i have seen something weird in oracle 10g, while parsing and validating the sql statements... maybe you can explain... So the following situation with my statements: alter system flush shared_pool; drop table a; create table a as select *

  • UNIT_CONVERSION_SIMPLE

    Hello All, I'm using the SAP FM UNIT_CONVERSION_SIMPLE to convert from QP to CS.  The function module returns with sy-subrc code = 1 which means that the conversion was not found.  I've looked in the master table of 0mat_unit and 0material and both Q

  • Random memory errors and resetting

    Hello folks I've got a KT4V motherboard and an Athatlon 1800 XP. The problem is that I keep getting occasional memory errors or the machine will just reset. (';(') The problems don't occur with any perticular  program or after any perticualr period o

  • Restricting inputfield on web dynpro

    Hi All, I am customizing web dynpro screens wherein some of the input fields should not accept more than 5 characters. I tried setting the 'length' attribute to 5 in 'properties' tab, but still I am able to enter more than 5 characters. Any other opt