posthog icon indicating copy to clipboard operation
posthog copied to clipboard

Add possibility of using properties of objects within a list property in insights

Open dannovify opened this issue 2 years ago • 4 comments

Is your feature request related to a problem?

I am sending a list of products represented as objects inside the order property. Currently, I cannot access any of the individual fields of each order to use it as a filter or as a break down.

Some simple thing like contains within products work, but doing anything more advanced like aggregations or calculations on 3rd level of properties does not seem to be supported.

Describe the solution you'd like

Have a new type of properties: list and object, that would allow me to select the filter as follows:

  • Event: order placed
  • Property: products
  • List object property: product_name

Describe alternatives you've considered

  • Using HogSQL does not work for me with properties.products.product_name = 'hog'
  • Flattening a schema or using HogSQL

Additional context

Thank you for your feature request – we love each and every one!

dannovify avatar Oct 05 '23 19:10 dannovify

Hey @dannovify , until HogQL supports this natively, you can do the following:

HogQL supports native clickhouse json, so you can still try to access those nested properties. It's just that the syntax isn't as nice. You'll have to keep doing JSONExtractArray or JSONExtractRaw until you get to your value. Check out clickhouse docs to see how to use these functions.

neilkakkar avatar Oct 06 '23 10:10 neilkakkar

This page should explain it a bit nicer still: https://posthog.com/tutorials/array-filter-breakdown

mariusandra avatar Oct 06 '23 10:10 mariusandra

+1 https://posthoghelp.zendesk.com/agent/tickets/19223 +1 https://posthoghelp.zendesk.com/agent/tickets/18711

darkopia avatar Oct 14 '24 10:10 darkopia

+1 from user:

Is your feature request related to a problem?

Filtering on arrays is currently complicated or impossible, limiting the ability to search structured data effectively.

Describe the solution you'd like

Introduce a feature that allows users to filter arrays using a "contains" function for numerical values.

Describe alternatives you've considered

Using complex HotQL queries, which are not user-friendly for non-technical users.

Additional context

Improving this feature would enhance the platform's capability to handle complex data structures.

annaszell avatar Oct 15 '24 19:10 annaszell

+1 https://posthoghelp.zendesk.com/agent/tickets/18710

darkopia avatar Oct 23 '24 10:10 darkopia

+1 This is a blocker for migrating to PostHog from Amplitude for me, as it can handle such event structure no problem

supoved avatar Nov 14 '24 11:11 supoved

1+

jannesblobel avatar Jan 21 '25 15:01 jannesblobel