# Setting up export template

**URL:** <https://community.silverfin.com/t/setting-up-export-template/2139>\
**Category:** Templates\
**Created:** [August 25, 2021, 11:29am UTC](https://community.silverfin.com/t/setting-up-export-template/2139 "2021-08-25T11:29:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nazirarahman](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@Nazirarahman](https://community.silverfin.com/u/Nazirarahman)\
**Post date:** [August 25, 2021, 11:29am UTC](https://community.silverfin.com/t/setting-up-export-template/2139/1 "2021-08-25T11:29:54Z")

</div>

Hi

I am setting up an export template. It is currently pulling through the Silverfin account number and description but not pulling through the CCH code.

The coding I have used is below

Silverfin code, Description, Amount, CCH Account {% newline %}  
{% for account in period.accounts %}{{ account.number }},{{ account.original\_name | replace:’,’,’’ }},{{ account.value }},{% assign sliced\_account = account.number | slice:0,6 %}{% for silverfin\_account in silverfin\_code\_array %}{% if sliced\_account == silverfin\_account %}{{ cch\_code\_array[forloop.index0] }}{% endif %}{% endfor %} {% newline %}{% endfor %}

I can’t see what i am doing wrong that it is not pulling the CCH codes.

Please could you check to see what I need to amend.

---

<div class="post-metadata">

**Author:** ![borjaGonzalez](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/borjagonzalez/32/825_2.png) [@borjaGonzalez](https://community.silverfin.com/u/borjaGonzalez)\
**Post date:** [August 27, 2021, 7:48am UTC](https://community.silverfin.com/t/setting-up-export-template/2139/2 "2021-08-27T07:48:31Z")

</div>

Hi @Nazirarahman,

Is that the full code? I can see that the declaration of the `cch_code_array` and `silverfin_code_array` are missing so you need the actual mapping of the cch codes. Could you share the full code if that is not the case?

Thanks,  
Borja

---

<div class="post-metadata">

**Author:** ![Nazirarahman](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@Nazirarahman](https://community.silverfin.com/u/Nazirarahman)\
**Post date:** [September 1, 2021, 7:29am UTC](https://community.silverfin.com/t/setting-up-export-template/2139/3 "2021-09-01T07:29:49Z")

</div>

Below is the full code

{% stripnewlines %}

{% capture silverfin\_code\_array %}100000;100001;100002;100005;100006;100007;100008;100100;100101;100102;100105;100106;100107;100108;100300;100301;100302;100305;100306;100307;100308;100400;100401;100402;100405;100406;100407;100408;110000;110001;110002;110005;110006;110007;110008;110100;110101;110102;110105;110106;110107;110108;110200;110201;110202;110300;110301;110302;110305;110306;110307;110308;110400;110401;110402;110405;110406;110407;110408;110500;110501;110502;110505;110506;110507;110508;110750;110751;110752;110755;110756;110757;110758;110800;110801;110802;110805;110806;110807;110808;110900;110901;110902;110905;110906;110907;110908;120000;120100;120200;120300;120400;120500;120800;140000;140001;140100;140101;140102;140103;140104;140200;140201;140202;140203;140300;140301;140302;140350;140400;140401;140402;140502;140503;140504;140505;140510;140600;140700;140750;140800;140900;140901;140902;141100;141200;141300;141400;240000;240001;240101;240102;240103;240200;240201;240300;240301;240340;240400;240401;240500;240501;240502;240503;240504;240507;240510;240601;240602;240603;240604;240605;240700;240704;240705;250000;250001;250101;250102;250103;250200;250201;250300;250301;250340;250500;250501;250502;250503;250505;250601;250602;250603;250604;250605;260100;300000;300100;310000;310100;310101;310200;310202;310300;400001;400002;420600;500001;500002;500003;500100;500300;510001;510002;510100;510150;510151;510152;510200;510201;510300;520000;520100;520150;520200;520300;520350;520351;520399;520400;520500;520600;520700;650000;650100;650101;650102;650150;650151;650152;650200;650201;650202;650203;650300;650350;650351;650399;700100;700101;700102;700150;700151;700152;700200;700201;700300;710000;710200;710201;710202;720000;720100;720200;720300;720350;720351;720399;720400;720600;720700;720800;720900;721000;721100;721200;721300;721400;725000;730000;730001;730100;730200;735000;740100;740200;740201;740204;740500;750100;750101;750103;750200;750400;750500;750600;750602;750604;750606;900000;900001;900002;900003;900004;900005;900006;900101;900401;901000;901001;901002;901100;901102;901103;901104;901105;901202;902000;902002;903000;903004;904000;904200;904201;904300;904301;930000;930100;930200;{% endcapture %}

{% assign silverfin\_code\_array = silverfin\_code\_array | split:’;’ %}

{% capture cch\_code\_array %}6040;6042;6046;6050;6051;6056;6053;6080;6082;6086;6090;6091;6096;6093;6000;6002;6006;6010;6011;6016;6013;6100;6102;6106;6110;6111;6116;6113;6200;6201;6203;6210;6211;6216;6212;6260;6261;6263;6270;6271;6276;6272;6410;6411;6413;6290;6291;6293;6300;6301;6306;6302;6380;6381;6383;6390;6391;6396;6392;6320;6321;6323;6330;6331;6336;6332;6350;6351;6353;6360;6361;6366;6362;6440;6441;6443;6450;6451;6456;6452;6700;6701;6707;6720;6721;6724;6722;6900;6920;6960;6970;6910;6930;6780;7100;7140;7170;7160;7161;7180;7540;7211;7580;7595;7200;7433;7420;7213;7310;7380;7350;7360;7305;7280;7435;7290;7330;7436;7720;7300;7439;7800;7810;7850;7000;7020;7050;7031;8000;8030;8100;8101;8102;8104;8103;8080;8060;8083;8085;8092;8150;8170;8160;8070;8086;8175;8190;8200;8330;8360;8270;8280;8390;8091;8393;9100;9101;9071;9073;9072;9074;9076;9102;9106;9077;9130;9140;9135;9107;9112;9000;9050;9186;9010;9020;9450;9500;9600;9710;9900;5001;9735;5130;9750;0010;0020;4310;0700;0500;0900;0600;0650;1010;1070;1000;1100;1110;1170;1035;1060;1620;1899;1290;1411;0710;1910;1900;1920;1935;1440;1400;1800;1960;2899;2000;2010;2070;2100;2110;2170;2500;2460;2510;2300;2910;2900;2920;2935;3000;3010;3070;3100;3110;3170;3065;3060;3090;3510;3500;3460;3520;3830;3210;3870;3910;3900;3920;3935;3440;3800;3891;3620;3600;3680;3700;3720;3730;3050;3890;3410;3411;3810;3840;3860;3610;3650;3630;3640;3220;3300;3320;3350;3340;3310;3400;3305;3221;3345;3330;4195;4000;4100;4150;4160;4120;4130;4180;4170;4300;4352;4210;4500;4529;4520;4510;4512;4517;4290;4250;4200;4362;4410;4465;4453;4450;4430;4600;4750;4605;{% endcapture %}

{% assign cch\_code\_array = cch\_code\_array | split:’;’ %}

Silverfin code, Description, Amount, CCH Account {% newline %}  
{% for account in period.accounts %}{{ account.number }},{{ account.original\_name | replace:’,’,’’ }},{{ account.value }},{% assign sliced\_account = account.number | slice:0,6 %}{% for silverfin\_account in silverfin\_code\_array %}{% if sliced\_account == silverfin\_account %}{{ cch\_code\_array[forloop.index0] }}{% endif %}{% endfor %} {% newline %}{% endfor %}

{% endstripnewlines %}

---

<div class="post-metadata">

**Author:** ![Michiel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michiel/32/2364_2.png) [@Michiel](https://community.silverfin.com/u/Michiel)\
**Post date:** [September 1, 2021, 2:45pm UTC](https://community.silverfin.com/t/setting-up-export-template/2139/4 "2021-09-01T14:45:58Z")

</div>

Hi @Nazirarahman ,

In the if statement you are comparing a string (sliced\_account) with a number (silverfin\_account). I suggest to convert the second to a string by using a capture statement

```auto
{% for silverfin_account in silverfin_code_array %}
  {% capture sf_account %}{{ silverfin_account }}{% endcapture %}
  {% if sliced_account == silverfin_account %}
    {{ cch_code_array[forloop.index0] }}
  {% endif %}
{% endfor %} 

```

Keep in mind to always paste code snippets in the style above. Also try to implement some indentation in your code to make it more readable.

Regards,

Michiel
