Wednesday, June 29, 2011

Coldfusion If Statements and How to Create an Air Passage in the Neck Using a Hollow Ball Point Pen

Who would have thought … Adobe Dreamweaver/Coldfusion has an insert form feature that allows you to insert checkboxes, radio buttons … you name it, just like the Visual Studio editor. Gooooo Dreamweaver!

Additionally, I have made an agreement with my bee sting allergenic co-worker that if his esophagus ever swells shut, or at the first sign of trouble such as a raised rash, I will stab him in the neck with a hollow pen in order to create an air passage, thus saving his life. I believe he is highly relieved.

Some code for those of you who like code:

This is a simple CF if, elseif statement that is highly important in writing in-line Cold Fusion code.

#sel_ac.addtocartinfo#

#sel_ac.addtocartinfo#

This ‘if’ statement is using a field (AddToCart) from a query (sel_ac), to set off an Add to Cart image button.

If the value is not equal to “Y”, then it displays addtocartinfo which generally says something like “Call to order, call 1-800 blah, blah, blah.

End if

And here is the inline, CF query it is using:

SELECT a.Brand ,

a.Name ,

a.skuRoof ,

a.skuCeiling ,

a.Image ,

a.copy,

b.AddToCart,

b.AddToCartInfo,

(SELECT SUM(skuPCPrice) FROM dbo.PROD_SKU WHERE skuNum IN ('' + a.skuRoof + '' + '','' + '' + a.skuCeiling + '')) AS skuPCPrice,

(SELECT SUM(skuRegPrice) FROM dbo.PROD_SKU WHERE skuNum IN ('' + a.skuRoof + '' + '','' + '' + a.skuCeiling + '')) AS skuRegPrice

FROM dbo.wiz_airconditioners a LEFT OUTER JOIN dbo.wiz_dometic b

on a.skuRoof = b.skuRoof

where a.brand='Dometic'

The query is basically “Froming” from a sql server data table imported from an Excel sheet. The data source connection details are passed through the request.dsn variable.

A left outer join is used so we don’t throw the baby out with the bath water in the left table if no values are present in the right table on the join of skuRoof.

The main field we are concerned with pulling here is AddToCart which is used in our statement and referenced as .

Some Ramblings About Coldfusion, JavaScript and AJAX

We use cold fusion pointed at web server … mapped through a Z drive to our development server.

Using Adobe dr3eamweaver to develop in ColdFusion …

Chiefly, we use a .cfm design page to which is composed chiefly of html and coldfusion functionality for the design. Cold fusion will call Javascript which is kept in separate .js files … used to query the data from an excel app guide which is loaded into MS Sql server … as well as product info again from prod tables in MS SQL server.

The java script calls AJAX which sends component calls to query the data.

And that is it. The main architecture of of Coldfusion to Javascript to AJAX to MS Sql server.

Tuesday, June 28, 2011

Larva-Script, Coldfusion and AJAX

Currently I am using a combination of Coldfusion, Java-script (larva script) and AJAX in my development position. Good stufff .. will also be using .Net: C#, ASP, C# and VB down the road. Currently using SQL server as well. Need toHad to reinstall apps this morning. Need to get my drives remapped ... etc.

Good stuff.

I have a healthy bucket of examples to follow now as well.

Code examples to follow ...