Last updated on
Apr 27, 2021
Description
This function returns item and item attributes by iterating every item in a table or a secondary index.
For more information, see Scan.
Category
History
ColdFusion (2021 release): Added this function.
Syntax
serviceHandle.scan(requestParameters)
Parameters
See request parameters of Scan.
Example
<cfscript> cred = { "credentialAlias" : "myalias", "vendorName" : "AWS", "region" : "us-east-2", "secretAccessKey" : "xxxxx", "accessKeyId" : "xxxx" } conf={ "serviceName"="DYNAMODB" } dynamo=getCloudService(cred, conf) tableName="MusicTableForDemo" scanStruct = { "TableName": "#tableName#" } scanResponse=dynamo.scan(scanStruct,{"customResponse":true}) arr=scanResponse.items writeOutput("<b>List of songs</b>" & "<br/>") mapFunction=function(item){ writeOutput(item.SongTitle & "<br/>") } arr.map(mapFunction) </cfscript>
Output
List of songs
Angie
Hey Jude
Let it be
Yesterday
Hello
Hello, I Love You
Hello
Hello, I Love You