Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default CFXML & CFFILE

    I am trying to use CFXML to retrieve stuff from a database and then make an XML
    file from the results and I am not sure if I am doing this write. Anyone done
    this before or know if its possible. Thanks. Code is attached.
    <CFFUNCTION NAME="displayDate">
    <CFIF #event_date_end# GT "">
    <CFreturn DateFormat(event_date, "mmmm") & " " & DateFormat(event_date,"d")
    & " -" & DateFormat(event_date_end, "d") >
    <CFelse>
    <CFreturn DateFormat(event_date, "mmmm d")>
    </CFIF>
    </CFFUNCTION>
    <cfquery name="getcalendar" datasource="calendarevents">
    SELECT title, description, event_date, public, proj_key, category,
    event_date_end, key
    FROM event_cal
    WHERE public=yes
    ORDER BY event_date
    </cfquery>


    <cfxml variable="calendar">
    <events>
    <!---CFOUTPUT creates order of Data--->
    Event
    <CFOUTPUT query="getcalendar">
    <CFIF #event_date# IS NOT "">
    <CFSET endcalendar = DateAdd("d", 183, Now())>
    <CFIF DateCompare(#event_date#, Now()) IS +1 AND DateCompare
    (#event_date#, #endcalendar# ) is -1>
    #displayDate()# #title#
    </CFIF>
    </CFIF>
    </CFOUTPUT>
    </events>
    </cfxml>
    <cfdump var=#calendar#>
    <!---Create XML File--->
    <cffile
    action="write"
    destination="\\webserver\calendar"
    file="C:\Documents and Settings\users\Desktop\rss.xml"
    output="test.cfm"
    </cffile>

    TheScarecrow Guest

  2. Similar Questions and Discussions

    1. CFXML and Flash
      Hi folks, I am trying to connect my database with Flash via Coldfusion 7. Is it possible for CF to create the XML using CFXML and then pass this...
    2. cffile
      Hi, How do u code for break line when you have the output for cffile? <cffile action="append"...
    3. USING CFFILE
      I am appending data from query to text file.The number of records appended approximately are about 35000 records.I wrote the code in the format...
    4. need help with cffile
      I am having some trouble with cffile - i am trying to uplaoad a few files in a form and rename them to be inserted into the database - the problem...
    5. Need Help With CFFILE Please
      Good morning. I was able to output my query to a text file without any problems. Now I have to adjust the results by formatting it to specific...
  3. #2

    Default Re: CFXML & CFFILE

    Is wrong :
    <cffile
    action="write"
    destination="\\webserver\calendar"
    file="C:\Documents and Settings\users\Desktop\rss.xml"
    output="test.cfm"
    </cffile>

    You should have something like :
    <cffile action="write" file="C:\target_folder\target_file_name"
    output="#Var with the content to write to the file#">

    Regards


    Sojovi Guest

  4. #3

    Default Re: CFXML & CFFILE

    You also have the word " Event" here right after your comment that has no
    relevance on anything:

    <cfxml variable="calendar">
    <events>
    <!---CFOUTPUT creates order of Data--->
    Event
    <CFOUTPUT query="getcalendar">


    Also you are saving it as a .cfm page, which is not recommended. You should be
    saving it as an .xml file:
    output="test.cfm"

    If you need to save it as a .cfm, use CFCONTENT to generate it.


    Abinidi Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139