Input fields with with key_array

Hello Community,

I have a question with my code and wondered if anyone can help with it?

I have a created a “fsli_category_array” to show a series of accounts’ names and each account matched with a key in the “key_array”, please see the array codes in the screenshots.


Now, I want to have a input cell to show the account’s name “fsli_category_array” as a default name, and make cell who have the same key, to automatically show the same overridden names. E.g., if my key “fsli_001” shows the overridden name of “Cash”, the other input fields with key “fsli_001” should show “Cash” as well.

This is my table codes, please see the 2 bold lines, I tried to capture the adjust_account_key and used this [adjust_account_key] in my input fields as {% input custom.unadjusted_misstatement_account.[adjust_account_key] default:fsli_category_to_show %} but the table not works properly now, could you please advise where is wrong in these 2 lines?

{% newline %}
{% assign accounts_selected = period.accounts.include_zeros | range:additional.journal_entry %}
{% for account in accounts_selected %}
{% capture journal_description %}{{ additional.journal_description | replace:" “,”" | replace:".","" | replace:"’","" }}{% endcapture %}
{% capture account_key %}key_{{ account.id }}{{ journal_description }}{% endcapture %}
** {% capture adjust_account_key %}key
{{ account.id }}_{% endcapture %} **
{% assign journal_account_number = account.number %}
{% assign fsli_category_to_show = ‘’ %}
{% assign bs_category_to_show = ‘’ %}
{% for item in keys_array %}
{% assign acc_collection = period.accounts.include_zeros | range:mapping_array[forloop.index0] %}
{% assign fsli_category = fsli_category_array[forloop.index0] %}
{% assign bs_category = bs_category_array[forloop.index0] %}
{% for account in acc_collection %}
{% if account.number == journal_account_number %}
{% assign fsli_category_to_show = fsli_category %}
{% assign bs_category_to_show = bs_category %}
{% endif %}
{% endfor %}
{% endfor %}
|
| {% comment %}{{ fsli_category_to_show }}{% endcomment %}{% input custom.unadjusted_misstatement_account.[adjust_account_key] default:fsli_category_to_show %}
|
|
{% if bs_category_to_show == ‘current_assets’ %}
{{ custom.debit.[account_key]-custom.credit.[account_key] | currency_dc:0 }}
{% assign tot_curr_assets = tot_curr_assets+custom.debit.[account_key]-custom.credit.[account_key] %}
{% endif %}

Much appreciated!
Flora

Hi @Flora ,

Thanks for sharing your question via our Community!

We had a first look at your code, and made a simplified example of what you try to do using the loops and variables you created and everything seems to be working fine what the default value fsli_category_to_show is concerned. However, for us it’s not completely clear what you expect adjust_account_key to behave like.

You also mention

but the table not works properly now,

Can you be a bit more precise on what the exact issue in the table is? It would also benefit if you could make a simplified example code for us to look into instead of copy pasting a section of the code so we get a good understanding of what you are trying to accomplish.

Thank you, I’m sure we’ll figure this one out together!

Kind regards,
Robin

Hi Robin,

Much appreciate for looking into my question and sorry about the confusions.
Our team directly reach out to Franky and this issue has been fixed now.
He helped us to figure it out that the issue is from the a variable used in the other line (input cells), which is a drop.

Thanks again for your team’s help!

Thanks for informing us @Flora :ok_hand: