Thursday, April 23, 2009

Returning SQL and other query metadata

I wanted to return the sql from a query that I was running to find out why no records were returned. Found information here about query metadata that not only returns the sql run at the server, but tells you about returning the parameters too.

qryTest.getMetaData().getExtendedMetaData().sql

qryTest.getMetaData().getExtendedMetaData().sqlparameters

Monday, April 20, 2009

_f is undefined

I was getting the above error in my firebug output. It was coming from an included template that I use elsewhere on the website and I couldn't figure it out. Turns out that the page from where the cfwindow is called had a form without a name and id on it. Once I gave the cfform a name and id the problem went away and it works now.

Monday, April 13, 2009

javascript function not found and cutting corners on code

I got hungup for several hours this afternoon on a couple of stupid issues. The first, I was getting a memory leak error and my browser was freezing up so that sometimes I had to restart. Turns out I did something I do alot in coldfusion, I included the end tag of a javascript tag in the emain tag like this:




I don't know why this is but I am sure there is an easy explanation that should make sense to me, but It didn't.

The other thing that took alot longer to figure out was a cfwindow that wasn't findinng the above attached .js file. I played around with the path and all sorts of stuff and couldn't figure out why it wasn't working. Because that script tag above has to be on the parent page that calls the cfwindow, not on the page that comes up inside the cfwindow.

Thursday, April 09, 2009

ModelGlue, Flash movie not loaded.

I am moving a site over to a MG3 site. I moved a flash movie that we have and it wasn't working. When I clicked on the movie (which I couldn't even tell where it was) I got the message "movie not loaded".

After searching the ModelGlue archives there were a few messages and they did give the answer even though it wasn't directly obvious, to me, at least. I was able to navigate directly to the html page that loaded the file, but via modelglue it didn't work.

Had to use absolute paths for all path statements, including where the file only was listed. All necessary files are in the same directory as the .swf movie, but I had to add the path to each of those, and I wasn't able to use a variable set at the top of the page either.

Example: views/page/map/myfile.swf where before it worked with just myfile.swf.

Friday, April 03, 2009

SQL Server Date Formats

As part of my last post I needed to spit out the date in the right format because I was using a javascript output that I couldn't use coldfusion to format. So I needed to use coldfusion and found a great reference for formatting dates natively in SqlServer:

http://www.sql-server-helper.com/tips/date-formats.aspx
SQL query join that returns only a max value in the joined table.

I have a somewhat complicated query. This query includes 4 or 5 tables. In my app, changes to the company table are logged to a company history table. I simply record the time of the update and that it was an update. When the record is created an entry is made recording the date and the type of "create.

Anyway, some records have been updated several times and I am returning search results. The user asked to have those results returned with the last updated date, which means I needed to join to that history table and return only the max(date) from records linked to the corresponding company.

The answer was to use a derived query and I found a great example here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=102255