Appends one structure to another.
structAppend(destStruct, sourceStruct [, overwriteFlag])
→ returns boolean
destStruct.append(sourceStruct [, overwriteFlag])
→ returns struct
true
true
false
config = {a:0, b:0};
options= {b:1, c:1};
structAppend(config, options, false);
writeOutput( serializeJSON( config ) );
Expected Result: {"A":0,"B":0,"C":1}
config = {a:0, b:0};
options= {b:1, c:1};
config.append(options, false);
writeOutput( serializeJSON( config ) );
Expected Result: {"A":0,"B":0,"C":1}
config = {a:0, b:0};
options= {b:1, c:1};
structAppend(config, options);
writeOutput( serializeJSON( config ) );
Expected Result: {"A":0,"B":1,"C":1}
Demonstrates how to construct a Request Context (rc) that combines the values of the form and url scopes
rc = {};
structAppend( rc, form );
structAppend( rc, url );
writeOutput( serializeJSON( rc ) );
In older ColdFusion version where this function is not supported yet, you can fall back to a native java method to achieve the same behavior except that it does not have the overwriteFlag
.
config = {a:0, b:0};
options= {b:1, c:1};
config.putAll(options);
writeOutput( serializeJSON( config ) );
Expected Result: {"A":0,"B":0,"C":1}
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.