Hey all, I’m trying to replicate a standard filter with a custom event property on an Insights report. The filter is on an attribute (“items”) that is an array of objects. Example: items = [{item_variant: “A”, sku: “1000”}, {item_variant: “B”, sku: “2000”}] In the Insights report, I can easily create a filter (see screenshot below). However, I’m not sure how to create the same filter using a filter with a custom property. The reason why I’d like to use a custom property is to use a regular expression instead of an exact match for the sku attribute. Thanks for your help!
Hi Frédéric M.. I was intrigued by this question bc I knew that you can select list object keys or values on breakdowns. But did not realize that they were not available for custom properties. I tried myself, failed, and then reached out to MxP tech support who confirmed that. However, with their input, I did find one possibility for what you want to do. It involves a complex custom property leveraging regex_extract, converting properties to text and converting back to numbers (if necessary). For example: I have a property which has "key" and "value" pairs in a list object. I made this custom property:
IFS(NUMBER(REGEX_EXTRACT(STRING(@"""{"joinPropertyType":"list","label":"guidedrec_filters","propertyDefaultType":"object","resourceType":"event","type":"object","value":"guidedrec_filters"}"""@),"[0-9]+"))>50,"Medium",NUMBER(REGEX_EXTRACT(STRING(@"""{"joinPropertyType":"list","label":"guidedrec_filters","propertyDefaultType":"object","resourceType":"event","type":"object","value":"guidedrec_filters"}"""@),"[0-9]+"))<=50,"Small")
So what that does is take the "guidedrec_filters" property (which is a list object), converts it to a string (so the JSON object is a complete string of keys/values). It then does a regex_extract to pull out the number values ([0-9]+). It then has that formula within an IFS, so if >50 its "medium" and if <=50 its "small". It's easier to read in the interface (image below).
Thanks Andrew!