Map some metrics into a variables

I’m trying to collect some health metrics from the Health app on Apple and automatically enter them into a Notion database.

My problem comes when collecting these metrics, since in the array where they are stored the order may vary. That is, perhaps one day the weight metric is in position 1 of the array and another day in position 2. So I would like to be able to obtain the value of the variables by telling Make the name of the metric.

I have tthis array aggregator with this output:

I need to obtain the value of the variable by indicating the name.
For example: if I indicate “weight_body_mass” it should return “61.849998474121094”

I have tried to collect that value in a new variable indicating the following:

But the Variable value field always shows me blank:

image

Any idea? :frowning:

Hi @Joshua_Hurtado_Cubel ,

If it is possible, could you attach the output bundle containing you data?
It will help a lot for building your function.

BR,

PBI

2 Likes

This is the Output bundle that I get from the Array Aggregator:

[
    {
        "array": [
            {
                "name": "body_fat_percentage",
                "value": 13.3
            },
            {
                "name": "lean_body_mass",
                "value": 53.6
            },
            {
                "name": "dietary_water",
                "value": 2060.9523809523807
            },
            {
                "name": "body_mass_index",
                "value": 20.2
            },
            {
                "name": "weight_body_mass",
                "value": 61.849998474121094
            },
            {
                "name": "sleep_analysis",
                "value": null
            },
            {
                "name": "active_energy",
                "value": 3093.6572764874763
            }
        ],
        "__IMTAGGLENGTH__": 7
    }
]

I have it configured like this:

So I think that you should use something like this:
image
You made a mistake, you should have used the raw name.

Please, find in attachment the blueprint I used.
Map some metrics into a variables.json (6.6 KB)

Hope it helps.

PBI

2 Likes