Am I missing something in my nested IFs?

I currently have a nested IF schema in a HTTP request model, and I recently updated it to account for UK tax.

Even though all values are present and true to output the desired "taxes":["uk_tax_20_sales"], I’m still getting it returned as "tax":20 — which equates to the last value output in the sequence.

Relevant code from the HTTP module;

{{if(124.total_tax = 0 & 124.source_name = emptystring | 124.source_name = "web"; replace(substring(106.json; 1; length(106.json) - 1); """tax"":0"; """taxes"":[""s_iva_export""]"); if(124.billing_address.country = "United Kingdom" & 124.source_name = emptystring | 124.source_name = "web"; replace(substring(106.json; 1; length(106.json) - 1); """tax"":20"; """taxes"":[""uk_tax_20_sales""]"); substring(106.json; 1; length(106.json) - 1)))}}



An update! I had tested the input values as rules on a router branch, and then had the second if statement for the UK tax to be parsed as an output — it worked as expected.

So, I still have no idea what part I was missing in this nested IF approach. :man_shrugging:t2: Must’ve been a missing parentheses, or ?

Anyway, to not waste anymore time with debugging that, I decided to go for a better approach.

I refactored the scenario to have a router with rule-based branches for the specific tax codes based on input data for country and other variables.