if(Len(arguments.id)){ return variables.ceData.getCEData(variables.getPageRatingFormName(),"id",arguments.id); }else if(Len(arguments.ratingPageID) and Len(arguments.userID)){ return variables.ceData.getCEData( customElementName=variables.getPageRatingFormName(), queryType="multi", searchValues="#arguments.ratingPageID#,#arguments.userID#", searchFields="ratingPageID,userID"); }else if(Len(arguments.ratingPageID)){ return variables.ceData.getCEData(variables.getPageRatingFormName(),"ratingPageID",arguments.ratingPageID); }else if(Len(arguments.userID)){ return variables.ceData.getCEData(variables.getPageRatingFormName(),"userID",arguments.userID); }else{ return variables.ceData.getCEData(variables.getPageRatingFormName()); } total = 0; ratings = getRating(ratingPageID=arguments.ratingPageID); if(ArrayLen(ratings)){ for(i=1;i<=ArrayLen(ratings);i++){ total = total + ratings[i].values.rating; } return total/ArrayLen(ratings)/10*100; }else{ return 0; } var ratingObject = StructNew(); ratings = getRating(id=arguments.ratingID); if(ArrayLen(ratings)){ ratingObject.dataPageID = ratings[1].pageID; } ratingObject.id = arguments.ratingID; if(rating neq -1){ ratingObject.userID = request.user.id; ratingObject.ratingPageID = arguments.ratingPageID; ratingObject.rating = arguments.rating; results = variables.csContent.populateContent(variables.getPageRatingCCAPIName(),ratingObject); return results.contentUpdated; }else if(StructKeyExists(ratingObject,"dataPageID")){ //Rating was -1. We need to delete the existing rating! return application.ADF.ceData.deleteCE(ratingObject.dataPageID); } return false;