Dear @vsr1 ,
I need a little bit of help if you have a few minutes to look over this query
WITH orderobj AS ({“us”:1, “gb”:2, “es”:3})
SELECT RAW appdoc
FROM app-live
e
JOIN app-live
AS a ON KEYS “meta:” || e.app_uuid || “:e:1”
WHERE e.sub_type= “app”
AND e.app_uuid IS NOT MISSING
AND e.game = TRUE
GROUP BY e.app_uuid
LETTING appdoc = MIN([IFMISSING(orderobj.[e.country_code],e.country_code), { e.country_code, e.app_thumbnail, a.dl}])[1]
the a.dl is an object of the format
"dl": {
"ae": {
"1614643200": 100,
"1614816000": 100
},
"ar": {
"1616457600": 100
},
"at": {
"1614729600": 100,
"1615075200": 100
},
"au": {
"1614643200": 400,
"1614729600": 300,
"1614816000": 200
}
}
I need to get the latest value in the object for a specific country
I have tried with a.dl.[e.country_code].[-1]
but it doesn’t work, also it seems that I cannot use things like to_number() inside the creation of the appdoc object.
Is there a way to get the latest value (the highest key value) from the object?