Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Some objects in the data blob are even more complex - an example is the "details" stanza of the po_lines data blob. The information is nested inside curly brackets, square brackets and curly brackets { [ { } ] } The information at the link doesn't get into how to parse out those elements. You're on your own!



Extracting from the updated inventory_instances table: as of the Orchid release, changes were made to inventory_instances table. This example shows how to extract values from the data array when the values are "objects". This example shows getting the subjects from the data blob:

SELECT

    instances.id AS instance_id,

    instances.hrid AS instance_hrid,

    subjects.data #>> '{value}' AS subject,

    subjects.ordinality AS subject_ordinality

FROM

    inventory_instances AS instances

CROSSJOINjsonb_array_elements((instances.data #> '{subjects}')::jsonb)

WITHORDINALITYAS subjects (data)