Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--- this assumes SQL for the whole thing; replace whatever you want with Mura iterators --->
- <cfset users = []>
- <cfset x = 0>
- <cfset agerange1 = 0>
- <cfset agerange2 = 0>
- <cfset male = 0>
- <cfset female = 0>
- </etc>
- <!--- loop over genres --->
- <cfquery name="get_genres">
- select genreid from genres
- </cfquery>
- <cfoutput query="get_genres">
- <cfquery name="get_shows">
- select showid from shows
- where genreid = #get_genres.genreid#
- </cfquery>
- <!--- loop over shows within a genre --->
- <cfoutput query="get_shows">
- <cfquery name="get_users">
- select userid from subscriptions
- where showid = #get_shows.showid#
- </cfquery>
- <!--- loop over the users in the subscription list for each show in genre --->
- <cfoutput query="get_users">
- <cfquery name="get_user_details">
- select age, dob, gender
- from users
- where userid = #get_users.userid#
- </cfquery>
- <!--- determine gender, age group --->
- <cfoutput query="get_user_details">
- <!--- calculate their age here based on dob --->
- <cfif (gender is male)>
- <cfif (age range is in first group)>
- <cfset male_agerange1 = male_agerange1 + 1>
- <cfelseif (age range in second group)>
- <cfset male_agerange2 = male_agerange2 + 1>
- </etc>
- <cfelseif (gender is female)>
- <cfif (age range is in first group)>
- <cfset female_agerange1 = female_agerange1 + 1>
- <cfelseif (age range in second group)>
- <cfset female_agerange2 = female_agerange2 + 1>
- </etc>
- </cfif>
- </cfoutput>
- </cfoutput>
- </cfoutput>
- <cfset x = x + 1>
- <cfset users[x] = {}>
- <cfset users[x].male_agerange1 = male_agegroup1>
- <cfset users[x].male_agerange2 = male_agegroup2>
- <cfset users[x].female_agerange1 = female_agerange1>
- <cfset users[x].female_agerange2 = female_agerange2>
- </etc>
- <cfset users[x].genre = (call to get Genre)>
- <cfset male_agerange1 = 0>
- <cfset male_agerange2 = 0>
- </etc>
- </cfoutput>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement