# Adding Results Tag to Fori

**URL:** <https://community.silverfin.com/t/adding-results-tag-to-fori/2402>\
**Category:** Templates\
**Tags:** result-tags, for\_loop\
**Created:** [February 3, 2023, 2:03pm UTC](https://community.silverfin.com/t/adding-results-tag-to-fori/2402 "2023-02-03T14:03:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnF](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JohnF](https://community.silverfin.com/u/JohnF)\
**Post date:** [February 3, 2023, 2:03pm UTC](https://community.silverfin.com/t/adding-results-tag-to-fori/2402/1 "2023-02-03T14:03:12Z")

</div>

Hi Team,

We want to add a Results tag to the following code to allow us to show the SIC code(s) for a company in another reconciliation and also as part of an insight.  
Any help as to how we do this would be greatly appreciated.

|Relevant SIC code(s):  
{% fori item in company.custom.investments %}  
{% if forloop.index != 1 %}|{% endif %}  
|{% input item.SIC %}  
|{% if forloop.index == 1 %}{% ic %}{::infotext}Get this from Companies House{:/infotext}{% endic %}{% endif %}  
{% newline %}  
{% endfori %}

Kind Regards

---

<div class="post-metadata">

**Author:** ![Kimberly\_Vlietinck](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/kimberly_vlietinck/32/1496_2.png) [@Kimberly\_Vlietinck](https://community.silverfin.com/u/Kimberly_Vlietinck)\
**Post date:** [February 6, 2023, 4:59pm UTC](https://community.silverfin.com/t/adding-results-tag-to-fori/2402/2 "2023-02-06T16:59:29Z")

</div>

Hi @JohnF,

I understand you want to create a result tag for every iteration of your fori loop. You will have to add a result tag inside the `{% fori %} ... {% endfori %}` and make sure that the result name is unique for every loop by using a dynamic name.

You can find more information on how to create a result-tag for each loop:

> [@CASE: create result tag in each loop](https://community.silverfin.com/t/case-create-result-tag-in-each-loop/1200):
>
> Let’s say we import certain data from a client, and we want to display each value of a certain column in a report template for instance: I’ll need to create a result-tag for each loop where data has been inputted. We can do this with the capture-method and the name of this can be used as a result-tag. Here’s the code: \<table class="usr-width-100"\> \<thead\> \<tr\> \<th class="usr-width-30 usr-line-bottom"\>\<b\>{% t "Kind" %}\</b\>\</th\> \<th class="usr-width-20 usr-line-bottom"\>\<…

And here’s some more information to explain why you should use dynamic name for the result in this case:

> [@CASE: dynamic variable names](https://community.silverfin.com/t/case-dynamic-variable-names/1198):
>
> To explain why we use dynamic variable names in this case: Let’s say we create a variable called : {% assign var\_xyz = "100" %} We also create this: {% assign i = "xyz" %} {% capture variable %}var\_{{ i }}{% endcapture %} So the output of {{ variable }} is simply the name we capture : var\_xyz However, if we want to access the value of the variable var\_xyz, we need to use this: {{ [variable] }} which outputs this: 100 So the name of the variable var\_xyz gets created by the captu…

Feel free to reach out if you have additional questions.

Kind regards,  
Kimberly

#result #result-tags #fori_loop

---

<div class="post-metadata">

**Author:** ![JohnF](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JohnF](https://community.silverfin.com/u/JohnF)\
**Post date:** [February 7, 2023, 8:04am UTC](https://community.silverfin.com/t/adding-results-tag-to-fori/2402/3 "2023-02-07T08:04:51Z")

</div>

Hi Kimberly,

Thanks for the advice, I’ll try and find the help I require from the links you provided.

Regards

John F.
