Whatever message this page gives is out now! Go check it out!
Object type | See |
Component Object Model (COM) | |
Common Object Request Broker Architecture (CORBA) | |
Java | |
ColdFusion component | |
Web service |
<cfscript>
myvar=""; // empty string
writeOutput(isNULL(myvar)); // returns NO
</cfscript><cfscript>
myvar=NULL; // value is NULL
writeOutput(isNULL(myvar)); // returns Variable NULL is undefined
</cfscript><cfscript>
myvar=JavaCast("null",0);
writeOutput(isNULL(myvar)); // returns TRUE
</cfscript><cfscript>
myvar=NULL;
writeOutput(isNull(myvar)); // returns TRUE
</cfscript>component{
this.enableNULLSupport=true;
}<cfscript>
myquery=querynew("id,name","integer,varchar",[[null,"hello"],[1,"null"],[null,"null"]]);
writedump(myquery);
writedump(format="text",var=#myquery#);
</cfscript>result = possiblyNullValue ?? DefaultValue<cfscript>
// The null coalescing (??) operator is a logical operator that returns its right-hand side operand
// when its left-hand side operand is null or undefined,
// and otherwise returns its left-hand side operand.
foo=javacast("null","") ?? "NULL coalescing"
writeOutput(foo)
writeOutput("<br/>")
baz=0 ?? 45
writeOutput(baz)
</cfscript><cfscript>
writeOutput("<br>")
function returnNull(){return NULL}
name = returnNull() ?? 'Adobe ColdFusion'
writeOutput(name & "<br>")
</cfscript><cfscript>
version = [1.1, NULL, ""]
writeOutput(version[1] ?? 'false')
writeOutput("<br>")
writeOutput(version[2] ?? 'false')
writeOutput("<br>")
writeOutput(version[3] ?? 'false')
</cfscript><cfscript>
// using structs
someStruct=StructNew('Ordered');
someStruct.name = "User";
someStruct.age= 24;
someStruct.isValidName = true;
someStruct.isValidAge = 'NO';
someStruct.address = NULL;
for (i in someStruct){
WriteOutput("#someStruct[i]#" ?? 'false');
writeOutput("<br>")
}
writeOutput("<br><br>")
</cfscript><cfscript>
myTeam=QueryNew("Jersey,Player_Name,Matches_Played,Win_Matches","integer,varchar,integer,integer");
RealMadrid={Jersey=1,Player_Name="Keylor Navas",Matches_Played=50,Win_Matches=null};
QueryAddRow(myTeam,RealMadrid);
RealMadrid={Jersey=7,Player_Name="Cristiano Ronaldo",Matches_Played=75,Win_Matches=70};
QueryAddRow(myTeam,RealMadrid);
cfloop(query = myTeam, startRow = 1, endRow = 2) {
wins = Win_Matches ?? 'Not Recorded'
writeOutput("#Jersey# | #Player_Name# | #Matches_Played# | #wins#" & "<br/>");
}
</cfscript><cfscript>
myQuery = queryNew("id,name,ctype","",
[
{id=1,name="1",ctype=true},
{id=2,name="Two",ctype=false},
{id=3,name="3",ctype="true"},
{id="4",name="4",ctype="false"}
]);
writeOutput ( SerializeJSON(myQuery) );
</cfscript>{"COLUMNS":["ID","NAME","CTYPE"],"DATA":[[1,"1",true],[2,"Two",false],[3,"3","true"],["4","4","false"]]}{"COLUMNS":["ID","NAME","CTYPE"],"DATA":[["1","1","true"],["2","Two","false"],["3","3","true"],["4","4","false"]]}<cfscript>
mybignum = 12345678901234567890;
mybignumtimes10=(mybignum * 10);
writeOutput("mybignum is: #mybignum#" & "<br>");
writeOutput("mybignumtimes10 is: #mybignumtimes10#");
</cfscript>writeOutput("#mystring#");writeOutput("#mystring#");"This is a number sign ##"writeOutput("List length using ; and , as delimiters: #listlen(Mylist, "";,"")#
List length using only , as a delimiter: #listlen(Mylist)#");UserHasBeenHere = True;myDate = "October 30, 2001";To specify | Use these formats |
Date | October 30, 2003Oct 30, 2003Oct. 30, 200310/30/032003-10-3010-30-2003 |
Time | 02:34:122:34a2:34am02:34am2am |
Date and Time | Any combination of valid date and time formats, such as these:October 30, 2003 02:34:12Oct 30, 2003 2:34aOct. 30, 2001 2:34am10/30/03 02:34am2003-10-30 2am10-30-2003 2am |
writeOutput("#LSDateFormat(Now(), ""ddd, dd mmmm, yyyy"")#");Encoding | Format |
Base64 | Encodes the binary data in the lowest six bits of each byte. It ensures that binary data and non-ANSI character data can be transmitted using e-mail without corruption. The Base64 algorithm is specified by IETF RFC 2045, atwww.ietf.org/rfc/rfc2045.txt. |
Hex | Uses two characters in the range 0-9 and A-F represent the hexadecimal value of each byte; for example, 3A. |
UU | Uses the UNIX UUencode algorithm to convert the data. |
Function | Description |
Converts a string that contains encoded binary data to a binary object. | |
Converts binary data to an encoded string. | |
Converts a string to binary data in a specified character encoding. | |
Converts a binary object to a string in a specified character encoding. | |
Converts string and binary data to Base64 encoded data. | |
Converts Base64 encoded data to binary data. The BinaryDecode function provides a superset of the ToBase64functionality. | |
Converts most simple data types to string data. It can convert numbers, date-time objects, and Boolean values. (It converts date-time objects to ODBC timestamp strings.) Adobe recommends that you use the CharsetEncode function to convert binary data to a string in new applications. |
myarray=ArrayNew(2);myarray[1][2]=Now();<cfset newArray=myArray><cfset depts=StructNew()><cfset MyStruct.MyValue=2>In ColdFusion versions through ColdFusion 7, this line created a Variables scope variable named "MyStruct.MyValue" with the value 2. |
depts["John"]="Sales"<cfset myStructure2=myStructure><cfset myQuery2 = myQuery>myQuery.Dept_ID<cfset myVar = myQuery.Employee[2]>You cannot use array notation to reference a row (of all columns) of a query. For example, myQuery2 does not reference the second row of the myQuery query object. |
<cfscript>
depts = structnew();
newStructure=depts;
depts.John="Sales";
depts=0;
writeOutput("#newStructure.John# #depts#");
</cfscript><cfset Server.SScopeQuery = myquery><cfset Server.SScopeQuery = 0>SELECT FirstName, LastName
FROM Employee
</cfquery><cfoutput> #myQuery.Firstname[1]# </cfoutput><br>
<cfoutput> #myQuery["Firstname"][1]# </cfoutput><br><cfoutput>#mycol#</cfoutput><cfoutput>#mycol[1]#</cfoutput><br><cfoutput> #myQuery['Firstname']# </cfoutput><br><cfoutput>#mycol[2]#</cfoutput><br><cfoutput> #myQuery.Firstname# </cfoutput><br>
<cfset myVar= myQuery['Firstname']>
<cfoutput> #myVar# </cfoutput><br><cfscript>
public FUNCTIOn FUNCTION a()
{
return variables.b;
}
public FUNCTION b()
{
return "Hal";
}
writeoutput(a());
writedump(a().getMetadata());
writedump(a.getMetadata());
writedump(a.getMetadata());
</cfscript>