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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:26:34+00:00 2026-06-02T04:26:34+00:00

I have 3 arrays as displayed below. I have no control over the arrays.

  • 0

I have 3 arrays as displayed below. I have no control over the arrays.

groups_array = [ {
    "group" : "Mobile Test Region",
    "id" : "251"
}, {
    "group" : "Mobile Demo Region",
    "id" : "252"
} ]
locations_array = [ {
    "location" : "M Testing",
    "id" : "1376"
}, {
    "location" : "Trade Show Machine",
    "id" : "1403"
}, {
    "location" : "M Trailer",
    "id" : "1471"
}, {
    "location" : "Test Los Angeles",
    "id" : "1475"
} ]
pairs_array = [ {
    "location_id" : "1376",
    "group_id" : "251"
}, {
    "location_id" : "1475",
    "group_id" : "251"
}, {
    "location_id" : "1403",
    "group_id" : "252"
}, {
    "location_id" : "1471",
    "group_id" : "252"
} ]

Here is the code I used to loop through the pairs_array and retrieve the location_id’s that correspond with the group id. Ti.API.info(pairs_array[s].location_id); outputs 2 location ID’s based on the groupid given using e.rowData.groupid.

for (var s = 0; s < pairs_array.length; s++) {
    if (e.rowData.groupid === pairs_array[s].group_id) {
        Ti.API.info(pairs_array[s].location_id); 
    }
}

I am trying to compare the strings and retrieve the location names using the location_id’s ive gotten from the IF statement. Should I just push the results into an array and loop through the location_array and the results and compare? If so, I’d like to see a good code snippet for that since the few times I tried I was not getting the expected output.

  • 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-02T04:26:35+00:00Added an answer on June 2, 2026 at 4:26 am
    for (var s = 0; s < pairs_array.length; s++) {
        if (e.rowData.groupid === pairs_array[s].group_id) {
            Ti.API.info(pairs_array[s].location_id); 
    
            // find location name
            for(var t = 0; t < locations_array.length; t++)
            {
                if(locations_array[t].id == pairs_array[s].location_id)
                {
                    location_name = locations_array[t].location;                        
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 arrays of information that I'm loading in to an UITableView control
I have a script below which reads on displayed information from my mysql database
I have this block of code below which is to control questions which are
I have my array displayed like it but I cant seems to be able
I have an array of Ember.Object s which is displayed by Handlebars {{#each}} helper
I have several 450 element character arrays (storing bitmap data to display on lcd
I am using PHP and I need to script something like below: I have
I have an array of dictionaries loaded from a plist (below) called arrayHistory. <plist
I have a problem with casting a variable (see below) to a String so
In the code below, I have a dictionary of NSNumbers that are turned into

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.