Been hard at work on a few Flex apps recently and one of them takes advantage of Coldfusion 9 for it’s remoting to talk to a database. In the past I’ve been using PHP which has worked quite well but this time I really wanted to see what CF9 could do and how easy it would be. I’m pretty sure I’ve said it before but I can’t understand why everybody doesn’t work with CF.. other than cost maybe. It has got to be the faster server side code to write hands down.
Anyways, the gotcha came when I was trying to get comparative data from two different tables. I could have used an inner join in the SQL but I actually wanted to set some values instead of just have them blank for some in case the data didn’t exist in one of the tables. It would have meant more work within Flex and I didn’t want that. Needed to keep the data coming in with the right formatting and all that so all I had to do was show it.
Now this is something that I actually knew for normal CF dev but for some reason didn’t think it would carry over into remoting but essentially it was a case problem. To put it in more detail I had issues with putting values into a structure, that it into an array and then passing it back. Here’s the deal with Coldfusion development. When you put database values into a query structure, they come out with the field names properly cased. “myField” comes out as “myField”. Stick those in a structure and all of a sudden you get “MYFIELD”. Seriously irritating and for some reason I just didn’t think it would carry over into remoting.. but of course it would. Silly me. Anyways after floundering around in Flex wondering if somewhere my code was wrong, I managed to get the variable/value pairs traced out and discovered what Coldfusion was doing. I wish it wouldn’t.. but that’s the way it goes.
Maybe that will help somebody who is getting into remoting with Flex and Coldfusion.