Reference a field in a formula - heavily nested json

Hi there,

I have a heavily nested JSON structure and I’m trying to access the value of one nested field to use in a formula for another nested field at the same level.

The nesting can be seen in the expression below. participants and identities are both JSON arrays, identifier is an object and type is a field. I’m trying to access this from the formula sections for the field:

field(‘event.participants.identities.identifier.type’)

I’m trying to access this from the formula section for the field: event.participants.identities.identifier.value

What I get when I use this expression in the formula is:

“value”: “error: Field ‘event.participants.identities.identifier.type’ not found”

Can you help me understand what I’m missing?

Sorry if it’s obvious, and I’m been dumb, I have read other posts first :wink:

cheers
Jon

Hi Jon, sorry for the delay. If both fields are at the same level of nesting you can just use the field without the rest of the path. So you should be able to just refer to the field as type.

What if the field you want to reference is nested 1 layer deeper?

Error I’m getting is…

error: Field ‘FinancialInfo.MonthlyTotalPremiumAmount’ not found

Thanks! Fun tool!

Ah, so what I said about nesting in previous post only applies when you’re nesting with arrays. If you’re just creating nested objects, you should just use the fully qualified name. For example field('ESPExtract.Policy.FinancialInfo.MonthlyTotalPremiumAmount').

Nice, thanks Mock. That worked, but I had to first put the field that I was referencing above the formula. The file I’m trying to effect will not be structured like this. Is there no way to reference a subsequent field?

Currently, the fields on which a formula depends must come first. That’s something I might be able to fix by processing all formulas last, but the same would still hold true for dependencies between formulas.

Hi there, was using the site today and actually ran into this same issue. I was wondering if you were still planning on implementing a fix. Everything else has been working well, thanks for the great tool! :slight_smile:

Hi Mockaroo, any update on this issue? Love the tool, but this is one thing that is hindering me–trying to use a field in a formula when the target field comes later in the schema.

Field 1 = Field 1 + Field 2
Field 2

I get an error when calculating Field 1.

Hi @mockaroo, Thanks for this tool. I just wanted to check if you have any plans to fix this issue?

1 Like