Skip to content

Instantly share code, notes, and snippets.

@nkostic
Created March 26, 2012 13:40
Show Gist options
  • Save nkostic/2205099 to your computer and use it in GitHub Desktop.
Save nkostic/2205099 to your computer and use it in GitHub Desktop.
Get Max Value of Key InS truct Array
<cffunction name="GetMaxValueOfKeyInStructArray" access="public" returntype="numeric" output="false">
<cfargument name="StructArray" type="any" required="true" />
<cfargument name="StructKey" type="any" required="true" />
<cfscript>
sqlMax=0;
temp=0;
for(i=1; i <= ArrayLen(arguments.StructArray); i=i+1){
if(StructFind(arguments.StructArray[i], "#arguments.StructKey#")){
temp=StructFind(arguments.StructArray[i], "#arguments.StructKey#");
if(temp>sqlMax){
sqlMax=temp;
}
}
}
return sqlMax;
</cfscript>
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment