Issues with values not matching even though identical when doing data cleansing

Hi @ngrayfc ,

Thank you for elaborating.
The number I’m sorting on is just the adjustment number. Unfortunately the account number is not something we can access on this drop.
I’ve taken my previous code and adjusted it based on all the information you want to fetch.
In this case I think it makes sense to push the entire account into an array, since you want to fetch more than just the number later on.
Then with a dynamic variable we can keep track of the total external adjustment posted on each account.

{% comment %}Create empty array{% endcomment %}
{% assign external_accounts_array = "" | split:";" %}

{% assign external_adjustments = period.adjustments.external | sort:'number' %}

{% for adjustment in external_adjustments %}
  {% assign transactions_external = adjustment.transactions %}
  {% for external_transaction in transactions_external %}
  
    {% comment %}Fetch account ID for use in dynamic var{% endcomment %}
    {% assign account_id = external_transaction.account.id %}
    
    {% comment %}Fetch the account and push it to the array{% endcomment %}
    {% assign adjusted_account = external_transaction.account %}
    {% push adjusted_account to:external_accounts_array %}    
    
    {% comment %}Value of each external adjustment{% endcomment %}
    {% assign adjustment_value = external_transaction.value %}
    
    {% comment %}Dynamic variable to retrieve the total external adjustment for each account{% endcomment %}
    {% capture external_adjustments_account %}external_adjustments_{{ account_id }}{% endcapture %}
    
    {% comment %}Add adjustment value to the dynamic variable for every external transaction{% endcomment %}
    {% assign [external_adjustments_account] = [external_adjustments_account]+adjustment_value %}    
    
  {% endfor %}
{% endfor %}

{% comment %}Remove duplicates{% endcomment %}
{% assign external_accounts_array = external_accounts_array | uniq %}

{% comment %}Print all accounts with external adjustments in this period{% endcomment %}
{% for account in external_accounts_array %}
  
  {% comment %}Rebuild dynamic var{% endcomment %}
  {% assign account_id = account.id %}
  {% capture external_adjustments_account %}external_adjustments_{{ account_id }}{% endcapture %}
  
  Original number: {{ account.original_number }}
  Original name: {{ account.name }}
  Original value: {{ account.value_without_adjustments | currency }}
  External adjustments total for that period {{ [external_adjustments_account] | currency }}
  Sum of Original Value and External adjustments (i.e. the new value of the account) {{ account.value_without_adjustments+[external_adjustments_account] | currency }}

{% endfor %}

I hope this was useful and you can use it as a basis :smiling_face: !

As to how these drops relate to each other, you were definitely on the right path.
The adjustments drop can bring you to the transactions, in which you can then access the accounts drop. Which means there’s no direct link between adjustments and accounts; the whole reason we need to work our way around it.

Kind regards,
Romy