Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3227564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:35:23+00:00 2026-05-17T16:35:23+00:00

I have this data and i need an output like this type of output..

  • 0

I have this data and i need an output like this type of output.. I basically need to have all the venues and their dates and all the songs associated to them ….if anyone can think of a better structure and how to achieve it I would be very thankful…

{ 
["Vector Arena - Auckland Central, New Zealand" => 
    { 
    "2010-10-10" => ["Enter Sandman", "Unforgiven", "And justice for all"]
    }], 
    ["Brisbane Entertainment Centre - Brisbane Qld, Austr..." => 
        { 
        "2010-10-11" => ["Enter Sandman"]
    }]
 }

so far i tried this…and not sure if i am moving in the right direction..

@venues = Hash.new {|hash, key| hash[key] = 0}
@requests = Request.find_all_by_artist("Metallica")
@requests.each do |request|
  @venues[request.venue] =  request.showdate
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:35:23+00:00Added an answer on May 17, 2026 at 4:35 pm

    Here is an efficient solution:

    result = Hash.new {|h1, k1| h1[k1] = Hash.new{|h2, k2| h2[k2] = []}}
    Request.find_all_by_artist("Metallica", 
     :select => "DISTINCT venue, showdate, LOWER(song) AS song"
    ).each do |req|
      result[req.venue][req.showdate] << req.song.titlecase
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data and need to create a json file with this structure
I have a need to build the data string dynamically. This is not working,
I have a dataframe with distances df<-data.frame(site.x=c(A,A,A,B,B,C), site.y=c(B,C,D,C,D,D),Distance=c(67,57,64,60,67,60)) I need to convert this to
I have this schema which I need to match 2 rows from user_data :
I have this data in cell A1: Majestic Properties Design District, LLC, Ste. 101,
i have this data | car_name | year | price | Honda | 2011
I have this data from a xml file: <?xml version=1.0 encoding=utf-8 ?> <words> <id>...</id>
I have this data: /blabla/blabla (abs,def) /yxz I use this regex (.*)(?:\(([^$]*)\))?\n But it
I have this data: 1, 0., 0., 1500. . . 21, 0., 2000., 1500.
I have this data in a table, for instance, id name parent parent_id 1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.