Skip to main content

Please help with copying location information from one board to another

  • October 29, 2023
  • 2 replies
  • 184 views

szabelin

Hello Monday.com members,
I have this question regarding my API query.

I have the main board, and a sub-board. Main board has some columns, including one Status column. Each one of the boards has a field of type ‘location’.

I need to query all items of the main board, extract location information (including lat, lng, address, etc), and populate the location of my sub-board if the status column has a specific value.

query Query_all($boardId: Int) {
      boards (ids: [$boardId]) {
        id
        name
        items {
          id
          name
          column_values {
            id
            text
          }
        }
      }
    }

Then inside my javascript I reference:

    for (const item of items) {
      let loc = item.column_values.find((item) => item.id === "location")['text']
      ...
   }

And the loc is set to a visible text portion of the address.

In the monday.com documentation for location, I can see a description for how to get a location by querying a specific item, but that would mean I have to run as many queries as I have rows in my board, and this would not work for my use case.
Am I missing something?
Any ideas how to go around it?

Please help,

2 replies

  • Participating Frequently
  • October 29, 2023

Investigate these two features of the API. They will let you filter and find items by values, (particularly the status). Also they get many items from a board at once - items_page returns up to 500 items in a single query. Locations are just regular columns - you would request the location column by ID in the items_page query of the board and the location is returned with each item. No need to query repeatedly.

monday API docs

Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • October 29, 2023

Thank you @anon29275264 for the data!

@szabelin let us know if you have any further questions!