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 7695869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:38:50+00:00 2026-05-31T21:38:50+00:00

I have an Object x = { y: 55.11, color: #4572A7, level: 0, drilldown:

  • 0

I have an Object

x =    {
            "y": 55.11,
            "color": "#4572A7",
            "level": 0,
            "drilldown": {
                "name": "MSIE versions",
                "level": 1,
                "color": "#4572A7",
                "categories": ["MSIE 8.0", "MSIE 6.0", "MSIE 7.0", "MSIE 9.0"],
                "data": [
                    {
                        "y": 33.06,
                        "color": "#4572A7",
                        "level": 1,
                        "drilldown": {
                            "name": "drilldown next level",
                            "level": 2,
                            "color": "#4572A7",
                            "categories": ["a", "b", "c"],
                            "data": [23,54,47]
                        }
                    },
                ]
            }
        }

Note this could actually go in any depth as I am adding new properties to the object but is speific format like

x['drilldown] = {}
x.drilldown['data] =[]
....and so on....

So suppose at a time I have below object structure:

x {
 drilldown {
         data [
            drilldown {
                 data [1,2,3]
               }
             ]
       }
 }
.....................

I need to go to the second last ‘data’ element of object ‘x’ and push new values. So based upon my example above it would be something like this:

x.drilldown.data.push(10);

So in all I need to find the second last data property in object ‘x’ and then push value in it

x.second last data array.push(10);

How can I do that?

==================================================================================

[Added Solution]

I added the below code and it works fine. I hope it is the right way to-do:

var data = [10,11,12];
var datatemp = x.drilldown;
var datatempvar = {};
for (;typeof datatemp != 'undefined';)
{
    datatempvar = datatemp;
    datatemp = datatemp.drilldown;
}
for(it=0;it<data.length; it++)
    datatempvar.data.push(data[it]);

Thanks everyone – this forum helped me a lot.

  • 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-31T21:38:51+00:00Added an answer on May 31, 2026 at 9:38 pm

    What should happen if a data array contains more than one value, especially some objects-with-drilldowns and some plain values?

    In every case you will have to set up a loop, which tests whether there are still drilldowns two levels further and does this for every level. When it breaks, the current level is the one where you want to add your elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object: var seriesOptions = { y: parseFloat($(this).find('y').text()).toFixed(2), color: colors[index], level :
I have a javascript object: data = { color: red, day: monday, list: {1,2,3,4,5,6}}
I have an object: function Shape(color, position, coordinates){ this.color = color; this.position = position;
I have an array of objects. Each object has a color attribute which could
I have a Graphics object of JPanel and that is working fine: import java.awt.Color;
I have an object: stdClass Object ( [Color] => Red [Shape] => Round [Taste]
I have an object, say a note, whose parameters I want to save in
I have tried this: g.RotateTransform(degrees); But nothing happens.I have one graphics object and one
I have an FBO object with a color and depth attachment which I render
I have an object within an object. It looks like this. var myLib =

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.