arrgh 22 Posting Whiz

Is there a way to check my local server logs?

No, you almost certainly can't check the host's logs. But if it happens locally too, you can check your own logs, sure. On the default install there are logs in 2 places {cfinstall}\logs and {cfinstall}\runtime\logs. {cfinstall} being something like c:\coldfusion8\

Totally unrelated, but this forums styles for "quotes" are hard to read, not to mention distinguish from the rest of the response. Whatever happened to indenting people?? ;)

arrgh 22 Posting Whiz

I haven't a clue about that one. It could be a driver issue. There was one a while back with NPE's and mySQL. But this is probably something different. Only thing I can think of is to check the server logs. Maybe they show moredetails.

arrgh 22 Posting Whiz

You can use most any tag you want within a query. The only thing that's important is the variables used are valid and the end result is valid sql.

, oldPage=<cfif IsDefined("FORM.oldPage") AND #FORM.oldPage# NEQ "">
<cfqueryparam value="#FORM.oldPage#" cfsqltype="cf_sql_clob" maxlength="255">
<cfelse>
''
</cfif>
[/quote]

Most of the generated DW code is garbage and the logic is pretty pointless. Fields like text boxes always exist. So the IsDefined("FORM.textBoxName") statements are useless for those types of form fields because they're always defined. You only need isDefined() is for fields that may not always exist. Like checkboxes, radio buttons or multiple select lists. But you can also use <cfparam ..> to define default values. That keeps the code cleaner IMO.

<cfif #FORM.oldPage# NEQ "">
<cfqueryparam value="#FORM.oldPage#" cfsqltype="cf_sql_clob" maxlength="255">
<cfelse>
''
</cfif>

Now even if you eliminate the unnecessary IsDefined()'s, what you're left with still doesn't make much sense. It's equivalent to saying if the value is not an empty string, use the value. Otherwise, still use the value. See what I mean? Just say it directly, without all the extra pound # signs, and using the correct data type. There's no reason to use CLOB for varchar fields.

, oldPage= <cfqueryparam value="#FORM.oldPage#" cfsqltype="cf_sql_varchar" maxlength="255">

The one place CFIF does make sense is if you need to insert NULL for some reason. Alternatively, you could use the "null" attribute instead

, brandID= <cfqueryparam value="#FORM.brandID#" cfsqltype="cf_sql_numeric"
      null="#not isNumeric(FORM.brandID)#">
arrgh 22 Posting Whiz

No problem. Happens to all of us. Though it's a good reason to get rid of that DW code. If it weren't for all those IsDefined() statements, it would've thrown the right error ;) ie Form field not defined.

arrgh 22 Posting Whiz

I have CF debugging enabled. Is ther a different debugger for MySQL??

No, it should show at the bottom of the page by default unless you've a) disabled debugging on that page b) have restricted the output by IP OR c) you're redirecting the debug output it elsewhere. Try the "result" attribute. Any difference?

arrgh 22 Posting Whiz

Sorry I didn't see your "I didnt see any generated sql" comment. My bad. But as I mentioned, you have to enable debugging in the CF Administrator. OR try adding the result attribute to the cfquery. I think it will include the sql too...

<cfquery name="theResult" ...>
INSERT INTO ... blah blah
</cfquery>

<cfdump var="#theResult#">

arrgh 22 Posting Whiz

Did you see my comments about enabling debugging and looking at the generated sql? There's no point guessing what's going on when you can see what SQL CF is generating and sending to your db ;) So enable debugging and look at the sql statements at the bottom of the page.

What value is used for that field?

arrgh 22 Posting Whiz

Well data can't just disappear ;) So either

A) You're looking at a cached page instead of the latest data OR
B) The value never being updated at all OR
C) something is overwriting it

When you have a problem like this the first thing to do is confirm the data is actually being updated. Enable debugging in the CF Admin. Temporarily remove the <cflocation url="bulbView.cfm">. Then test your UPDATE and look at the generated sql. What's the UPDATED value for that field?


On a side note, do yourself a favor and don't use Dreamweaver generated code. Honestly it's poor code and is hard to read and debug.

arrgh 22 Posting Whiz

Sorry to wake the zombies (this thread is 5 years old...). But for newer CF versions use array notation, not evaluate()

<cfset tmpDate = FORM["txtFFDateSet#i#"] >

arrgh 22 Posting Whiz

You could track the previous value yourself using a variable. Simply initialize it before your query loop starts. Inside the loop perform your comparison. Then update the variable with the current value the end of each loop.

<cfset previousWorkshop = "">
<cfoutput query="yourQuery">
   <cfif (some comparison with previousWorkshop here ...)>
       ... do stuff ...
   </cfif>

  <cfset previousWorkshop = currentWorkShop>
</cfoutput>

Alternately, you can access any valid query row using array notation #queryname["columnname"][ rownumber]#

arrgh 22 Posting Whiz

Ah, ok. But just to keep things straight, the DateAdd() function is what's actually adding 1 year to your date. DateFormat() doesn't do anything but make the value pretty ;)

arrgh 22 Posting Whiz

I thought I did the right thing in updating the date to 1 year ahead. What I did was instead of DateFormat code, I did the TimeFormat code.

I'm not sure what you mean. Neither of those functions perform date math. They only format values for output. Also, TimeFormat() is used for formatting time values, not dates.

arrgh 22 Posting Whiz

Ok, but do you just want to store the URL ie http://www.somesite.com *only* or the whole anchor string ie

<a href="http://www.somesite.com"><img width="1047" height="583" alt="" src="/siteMediaFiles/CELEBRITY%20COLLECTION%20HOME%20PAGE.jpg" /></a>
arrgh 22 Posting Whiz

... or do you want to extract the href URL for tracking purposes? Your goal wasn't clear to me either.

arrgh 22 Posting Whiz

I didn't think the documentation was that cryptic. But then I'm more of a "teach a man to fish ..." kind of person ;)

tiny7415 commented: Good way to teach a person!!! +1
arrgh 22 Posting Whiz

Thanks for posting it. Too bad there's no way to trade generic objects back and forth without creating a separate class. But at least you found something that works! That's more than I've seen until now..

arrgh 22 Posting Whiz

Oh ... yeah, I remember that. Thank goodness they got rid of the "." and ".."!

arrgh 22 Posting Whiz

The problem is the "filter". Using *.* will filter out most directories because they don't have a "." in the name. Remove the filter and cfdirectory will return everything (files and subdirectories).

arrgh 22 Posting Whiz

Found one article suggesting you return objects instead. I haven't tried it. Let us know if it works.
http://coldfusion.sys-con.com/node/47199

arrgh 22 Posting Whiz

Tacking onto a question that's over 2 years old, (and is totally unrelated to what you're asking!), is probably not the best way to get an answer ;) Open a new question ..

arrgh 22 Posting Whiz

From the little I've read there are some compatibility issues w/.net and soap. I haven't seen any success stories. Just suggestions to use xml instead.
http://stackoverflow.com/questions/1132536/consuming-apachesoapmap-complex-datatype-in-webservice-using-net

arrgh 22 Posting Whiz

By default cfdirectory lists both files and subdirectories. If you're only seeing files it suggests you're using a filter or some combination of attributes that excludes them. Please post your code.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f99.html

arrgh 22 Posting Whiz
arrgh 22 Posting Whiz

Any number of things could be happening. We'd need to see the rest of the code to see why it's not firing as you expect.

arrgh 22 Posting Whiz

You mean add new options to a <select> list? Yeah, you can do that with javascript. Somethin like the code below. Just remember, javascript is cAsE sEnSiTivE ;)

<select id="yourSelectList" ....>
    <option value="1">grapes</option>
    <option value="2">pears</option>
</select>
<script type="text/javascript">
    var list = document.getElementById('yourSelectList');
    list.options[list.length] = new Option('strawberries', '3');
    ...
</script>
arrgh 22 Posting Whiz

form.Report_Purpose_Code[1]

FORM fields aren't arrays. They're simple names. So make the <form> field names unique, and use the simple names to populate the form.

... value="#form.Report_Purpose_Code1#">
... value="#form.Report_Purpose_Code2#">

arrgh 22 Posting Whiz

Not sure I follow. Why do you need to pull the object into CF? You can just copy it from one table to another in a query.

ie
INSERT INTO Table2 ( OleObjectColumn)
SELECT OleObjectColumn FROM Table1

Though I'm sure you already know MS Access and storing images is not a great option ... ;)

arrgh 22 Posting Whiz

Yeah, it will run fine as long as the right syntax is used <!--- comment --->. CF comments are skipped/removed when the code executes. So they're only visible to you, not the receiving program.

You can test it by create a page that displays the current time
<!--- what happens to this comment? --->
<cfoutput>#now()#</cfoutput>

Run the page and do a view source. Notice CF comment isn't visible in the generated html? It's automatically removed when CF compiles the code.

(When I first learned CF, I didn't realize CF comments have 3 dashes "-". So I was only using 2 and kept wondering why it didn't work ;)

arrgh 22 Posting Whiz

... a pdf in cfm page.
It needs to run the standard program (acrobat reader ,...) and then, open my PDF file

Just to be clear, you can't control what happens on the user's computer from the CF server. What you *can* do is serve the pdf in such a way that it will most likely be opened by Acrobat. However, for that to happen, the user must have Acrobat installed on _their_ computer. Most people do have it installed - but again, that's not something you can control.

Anyway, if you already have an _existing_ pdf, use <cfcontent> with the correct mime type to serve the pdf to the user's browser.

<cfcontent type="application/pdf" file="c:\pathTo\yourFile.pdf">

If you prefer, you can use <cfheader> (first) to tell the browser whether the pdf should be treated as an "attachment" or displayed "inline" ie witin the browser window.

<cfheader name="content-disposition" value="attachment; filename="desiredFileName.pdf"/>
<cfcontent type="application/pdf" file="c:\pathTo\yourFile.pdf">

You can read more about both tags in the online documentation
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_c_11.html

arrgh 22 Posting Whiz

The best way to answer that type of question is to try it. Did you? :)

arrgh 22 Posting Whiz

Good Luck

-----------
Cast not pearls before swine

arrgh 22 Posting Whiz

If the code is doing something different than you want .. it is probably wrong. Because checking the recordcount definitely works. I use it all the time ;)

arrgh 22 Posting Whiz

filter the results in the query

It's better to filter in the db. The less info you return the better.

the template just exits, and no error message is given.

That's because no actual error occurred. The .cfm template only does what you tell it to do. So unless you're saying "do X when the query contains 0 records", nothing is going to happen.

If no matches were found, the query recordCount will be 0. Just use that value to do whatever it is you want to happen when "no match" is found.

(run the query)

<cfif results.recordCount gt 0>
records WERE found. do stuff here ...
<cfelse>
no match found. do something else...
</cfif>

arrgh 22 Posting Whiz

<cfqueryparam value="#form.selDate#" cfsqltype="cf_sql_timestamp">

In case it wasn't obvious, that was just to demonstrate the relation between your columns/fields and the example. In the real code you'd need use LSParseDateTime() on the form fields first.

arrgh 22 Posting Whiz

First, those dates aren't going to work the way you're thinking. The regular CF date functions use U.S. date formatting rules ie mm/dd/yyyy. It will be able to figure out some values like 27/05/2010. But when you say "07/05/2010", you're going to get July 5th, not May 7th.

If your CF instance is using a locale where dd/mm/yyyy is the standard (like in the UK, etc..) then use LSParseDateTime() on your date string first. LSParseDateTime will parse FORM.SelDate into a date _object_ using your locale's rules. (Obviously, nothing will change if your machine is using the English (US) locale.)

<cfset parsedDate = LSParseDateTime(FORM.SelDate)>

If you're not sure what locale you're running, check:

<cfdump var="#getLocale()#">
<cfset #CalDate# = #DateFormat( DateAdd( 'd', #FORM.SelDays#, #FORM.SelDate# ), 'dd/mm/yyyy' )#>

Don't use DateFormat(). It's for display purposes only because it returns a string, not a date object like LSParseDateTime(), dateAdd(), etc... When you use strings, unexpected things can happen (like getting July 5th instead of May 7th). So always use date objects unless you're displaying output.

As far as the query from the link, just convert the example to fit the columns in your form and table. So the subquery would find all rooms that _are_ reserved between your two dates: FORM.SelDate and CalDate.

Totally untested, but something like

<!--- Legend

       SD = startdate, ED = enddate    (BookingDateIN and BookingDateOut)
       FS = filter startdate, FE = filter enddate (FORM.SelDate and CalDate)

       where FE >= SD and FS <= ED
      ---> 

       ie .... …
arrgh 22 Posting Whiz

I need to show all the rooms that are NOT booked between two dates entered.

I would approach it another way- with a subquery.

The query in the link I posted earlier would give you the _reserved_ rooms. Obviously that's the opposite of what you want. But if you use it as subquery, and add in a NOT EXISTS clause, it should return the results you want: ie Rooms that are not reserved

--- get unique rooms
SELECT r.RoomName, etc...
FROM YourRoomTable r
--- that are NOT in the set of RESERVED rooms
WHERE NOT EXISTS (
... select query from the other thread ....
)

arrgh 22 Posting Whiz

First, I doubt you are going to get that all in one query and it is probably a mistake to try. (You'll probably end up writing it as a stored procedure). Second, what you have described is really has nothing to do with CF. It is almost entirely SQL. So you may have better luck asking in a db guru area.

That said, the usual way to simulate cross tab queries is with CASE statements. This article shows one option (simple cross tab query). I wouldn't use the second dynamic option listed. It's a little hairy for my tastes ...
http://www.simple-talk.com/sql/t-sql-programming/creating-cross-tab-queries-and-pivot-tables-in-sql/

arrgh 22 Posting Whiz

Application then lists all the rooms. Room status will be shown beside room, either availiable or occupied.
The application will run a query for each room using the current date to find out what rooms are booked.

Instead of doing most of the logic in CF, you would be better off using SQL. Run a query against your "reservations" table to find out which rooms are available during the desired date periods. But that's all db logic:

http://forums.devshed.com/ms-sql-development-95/filtering-on-startdate-and-enddate-question-277324.html

You're going to have to know some SQL, in addition to CF. It's not hard. But if your course doesn't cover SQL, definitely start with a tutorial like this one first:
http://www.w3schools.com/sql/default.asp

The db structure you described so far is not bad. You'll have to build on it for pricing, etc. But the basics are right

TABLE: Rooms (Unique rooms)
TABLE: Reservations (RoomID, StartDate, EndDate)

Example:

<cfset #myNumber# = 3>
<cfset #first# = 1>
<cfset #last# = 7>

<cfif #myNumber# GTE #first# AND #myNumber# LTE #last#>
Your number is between the range
...
</cfif>

Get rid of all the extra pound signs in those lines. You don't need them, and the code looks more professional without them.

ie Use <cfset myNumber = 3>
Instead of #myNumber# = 3>

arrgh 22 Posting Whiz

(What you describe would be bad in a real application) But it sounds like you have already mapped out an algorithm. So how about showing some good faith effort first.

What code have you tried, what problems are you having, etc...?

aww can be bothered... just gawna show

Just a bit of advice, your .. erm... initiative, grammar, and lack of any code whatsoever - are not exactly motivating us to want to help here .. ;-)

arrgh 22 Posting Whiz

Assuming the cfc's are okay. A few things to try separately for grins:

(Make sure your test page has only the cfselect code, nothing else)

1) Use different values for the select "name" and "id"
2) Use the element "ID" instead of "name" in the bind
3) Use a fully qualified element path for the second bind ie formName.elementNameOrID.value

arrgh 22 Posting Whiz

I have been doing some tests and it looks like the server configuration doesnt allow to use methods from component ( is that possible?).

Only methods on the same file =s.... Does that make any sense at all ? Dont know much about the CFAppServer

I've never heard of anything like that. Usually shared hosts disable entire options, like createObject("java"). I've never heard about disabling individual portions of cfinvoke.

arrgh 22 Posting Whiz

my hosting said the session management is enabled on the server, and im enabling at Application.cfc with <cfset this.sessionManagement = true/>

But where and when is the component itself called? Usually you'd have something like this somewhere.

<cfinvoke component="YourComponent" method="init" ...> ... or
<cfset obj = createObject("component", "YourComponent")>

If it's only a problem with CF8, then yeah trying it with CF9 is a good idea.

arrgh 22 Posting Whiz

First ... that's a lotta' code. But from a quick glance, my question is where is this component called/instantiated? I'm assuming session management is properly enabled, yes?

<cfset session.anuser = anuser/>
</cffunction>
</cfcomponent>

That's kindof breaking encapsulation though..

arrgh 22 Posting Whiz

hi
i'm working on airline resrsvation system and i have no idea to make the design for it
i need helping please

Ha ha. Answer: Hire a developer that does know how to design it for you.

arrgh 22 Posting Whiz

In the end, I found that if I moved the hidden, non-selectable field to the end of the grid, I don't get this issue. Kind of stupid and not a satisfying resolution but it's working... for now.

Yeah, that is a slightly lame. But sometimes you just have to do what you gotta do to make it work.

arrgh 22 Posting Whiz

Oh, I was testing with CF8 which doesn't have this feature I think. I see there are several entries on it:
http://www.danvega.org/blog/index.cfm/2008/3/5/Hiding-Columns-In-cfrgids-Column-Context-Menu

It sounds like the menu lists hidden columns by default? I'm not sure that makes sense. But at least there's a workaround

arrgh 22 Posting Whiz

I haven't tested the code. But assuming "select" really is the problem, other options are to a) hide the column(display=false) or b) duplicate the value in your query and hide one version, and show the other. It doesn't matter if the visible version is editable, because you'll just ignore it in your action page.

Though I'm kinda wondering if "select" is really the issue ... it sounds odd.

arrgh 22 Posting Whiz

Yeah, that makes more sense.

arrgh 22 Posting Whiz

As a general rule, I would leave as much data crunching work to be done as possible on the database server as it will be much more efficient.

Like I said, in this case they have almost no choice. Since it can't be done in a QoQ ;-)

In the situation you described, it might be better to create a "View" in the database based on your above SQL and then use a simple query to pull data out of that.

Maybe. Views tend to be useful when the same calculated information is used in multiple places. If something is only used on once, or one page only, it's generally not worth it to create a view just for that purpose.

arrgh 22 Posting Whiz

The Code above queries a cfc and returns the results to the second cfselect. My question would be how to return the result to a cfinput box? Is that even possible.

It doesn't make much sense to return _multiple_ results to a cfinput box. Perhaps you're thinking of something different, like an auto-suggest maybe..?