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

  • Home
  • SEARCH
  • 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 8240695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:34:41+00:00 2026-06-07T20:34:41+00:00

my json array store looks like this [{ role: Executive Director, name: David Z,

  • 0

my json array store looks like this

[{
"role": "Executive Director",
"name": "David Z",
...},
{
"role": "Executive Director",
"name": "David Z",
...},
{
"role": "Non Executive Chairman",
"name": "Hersh M",
...},
{
"role": "Non Executive Director",
"name": "Alex C",
...},
{
"role": "Company Secretary",
"name": "Norman G",
...}]    

from this array comes a few html tables.

I loop through store to a draw html table as part of an ajax success function, like this

var table = '';
table += '<tr><td......</td>';
$.each(store, function(i, data) {
   // draw row...
   // draw row etc...
});
table += '</tr></tbody>';
$("#table_d").append(table);

however for one of the tables I want to skip the 2nd occurrence of David Z (or whatever name that occurs more than once)

var table = '';
table += '<tr><td......</td>';
$.each(store, function(i, data) {
    if (i > 0, store[i].name != store[i-1].name) { 
       // draw row...
       // draw row etc...
    }
});
table += '</tr></tbody>';
$("#table_d").append(table);

the array will always be ordered so I can compare store[i].name against store[i-1].name for a duplicate name.

so how can I correctly express if store[i].name != store[i-1].name run loop?

  • 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-06-07T20:34:43+00:00Added an answer on June 7, 2026 at 8:34 pm

    If I understand your question correctly, I think you just need to do this

    if(i > 0)
    {
        if(store[i].name != store[i-1].name)
        {
            //run code here
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I store an array such as [1,2,3,4] or some JSON like {name:John Johnson,street:Oslo,
I've json array like this: {GetReportResult: [ {bulan:4,total:2448,type:CHEESE1K,uang:8847823}, {bulan:4,total:572476,type:ESL,uang:5863408410}, {bulan:4,total:46008,type:ESL500ML,uang:234498301}, {bulan:5,total:5703,type:CHEESE1K,uang:134929306}, {bulan:5,total:648663,type:ESL,uang:6645764498}, {bulan:5,total:51958,type:WHP,uang:631994613}, {bulan:6,total:6190,type:CHEESE1K,uang:104527773},
I have a JSON array like this: { forum:[ { id:1, created:2010-03-19 , updated:2010-03-19
I have a multidimensional array that looks something like this: ourThing = array( 'id'
My .php code in a file fetchvalues.php looks like this: echo json_encode(array($PostedDate.Places.$Company.$Designation.$ProjectDetails.$DesiredCandidate.$HRName.$HRContact.$Email)); This file
I have a JSON string (from PHP's json_encode() that looks like this: [{id: 1,
I Have a json array like [{name:A,value:A},{name:B,value:B},{name:C,value:C}] How can i pass(to the backend) and
I am trying to store a json encoded array into a MySQL field. The
I have a JSON array like below: var jsonArray = [{k1:v1},{k2:v2},{k3:v3},{k4:v4},{k5:v5}] I don't know
How can i convert this JSON array: This is a serialized JSON array 2012-06-18

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.