# Display data from either Query or Multiple Relations

**URL:** <https://community.glideapps.com/t/display-data-from-either-query-or-multiple-relations/74499>\
**Category:** Ask for Help\
**Created:** [June 30, 2024, 9:16pm UTC](https://community.glideapps.com/t/display-data-from-either-query-or-multiple-relations/74499 "2024-06-30T21:16:08Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![SG\_DC](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@SG\_DC](https://community.glideapps.com/u/SG_DC)\
**Post date:** [July 6, 2024, 10:57pm UTC](https://community.glideapps.com/t/display-data-from-either-query-or-multiple-relations/74499/3 "2024-07-06T22:57:20Z")

</div>

Thanks so much! That is very helpful. Using your example, I was able to output the proper string with total quantities for each.

However, in the original example I used, I was sort of summarizing the use case in an attempt to simplify it a bit. I’m wondering if you can help with the exact use case, as I’m hoping to display this on the layout side with actual attributes, instead of just as a text. Here’s an exact example of my use case…

After using your version of “JSON Final” in the POs table, I have a compiled JSON column that looks like this:

```auto
  "paperStocks": [
    {
      "paperStockName": "Colorplan Rust 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/Pbr9ZoZFIlkdKC66PFen.jpg",
      "sheetsNeeded": 34
    },
    {
      "paperStockName": "Colorplan Emerald 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/RaHqVSTLTpzKs5trZRde.jpg",
      "sheetsNeeded": 34
    },
    {
      "paperStockName": "Colorplan Stone 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/DStY9ubPnuNYI7LCqCjQ.jpg",
      "sheetsNeeded": 50
    },
    {
      "paperStockName": "Colorplan Real Grey 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/josQfHiNtexMP15Tp6cT.jpg",
      "sheetsNeeded": 50
    },
    {
      "paperStockName": "Colorplan Rust 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/Pbr9ZoZFIlkdKC66PFen.jpg",
      "sheetsNeeded": 7
    },
    {
      "paperStockName": "Colorplan Emerald 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/RaHqVSTLTpzKs5trZRde.jpg",
      "sheetsNeeded": 19
    },
    {
      "paperStockName": "Colorplan Stone 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/DStY9ubPnuNYI7LCqCjQ.jpg",
      "sheetsNeeded": 7
    },
    {
      "paperStockName": "Colorplan Real Grey 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/josQfHiNtexMP15Tp6cT.jpg",
      "sheetsNeeded": 13
    },
    {
      "paperStockName": "Colorplan Rust 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/Pbr9ZoZFIlkdKC66PFen.jpg",
      "sheetsNeeded": 25
    },
    {
      "paperStockName": "Colorplan Stone 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/DStY9ubPnuNYI7LCqCjQ.jpg",
      "sheetsNeeded": 25
    },
    {
      "paperStockName": "Colorplan Real Grey 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/josQfHiNtexMP15Tp6cT.jpg",
      "sheetsNeeded": 25
    },
    {
      "paperStockName": "Colorplan Rust 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/Pbr9ZoZFIlkdKC66PFen.jpg",
      "sheetsNeeded": 9
    },
    {
      "paperStockName": "Colorplan Emerald 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/RaHqVSTLTpzKs5trZRde.jpg",
      "sheetsNeeded": 9
    },
    {
      "paperStockName": "Colorplan Stone 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/DStY9ubPnuNYI7LCqCjQ.jpg",
      "sheetsNeeded": 9
    }
  ]
}

```

Using your javascript - slightly modifying it - I’m able to have that output as a string, where it correctly combines all of the likeminded “colors” (by paperStockName in my case). However, instead, I modified the code to output as JSON, with the result being:

```auto
{
  "paperStocks": [
    {
      "paperStockName": "Colorplan Rust 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/Pbr9ZoZFIlkdKC66PFen.jpg",
      "sheetsNeeded": 75
    },
    {
      "paperStockName": "Colorplan Emerald 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/RaHqVSTLTpzKs5trZRde.jpg",
      "sheetsNeeded": 62
    },
    {
      "paperStockName": "Colorplan Stone 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/DStY9ubPnuNYI7LCqCjQ.jpg",
      "sheetsNeeded": 91
    },
    {
      "paperStockName": "Colorplan Real Grey 130# - 17.5 pt",
      "paperSwatchColor": "https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/15ddj7K6XZ6W5o75fhxq/pub/josQfHiNtexMP15Tp6cT.jpg",
      "sheetsNeeded": 88
    }
  ]
}

```

Now that I have that compiled final JSON column for each PO, do you know of a way to display this as a list collection (or some other way) on the layout side of the PO screen?

Found [this thread](https://community.glideapps.com/t/display-json-as-list/49629) but couldn’t quite figure out how to make it work.

---

_[View the full topic](https://community.glideapps.com/t/display-data-from-either-query-or-multiple-relations/74499)._
