# Questions: Table not being shown; Accounts not selecting from CY information

**URL:** <https://community.silverfin.com/t/questions-table-not-being-shown-accounts-not-selecting-from-cy-information/1124>\
**Category:** Templates\
**Tags:** tables, register, stripnewlines\
**Created:** [August 16, 2018, 10:07am UTC](https://community.silverfin.com/t/questions-table-not-being-shown-accounts-not-selecting-from-cy-information/1124 "2018-08-16T10:07:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThomasB](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@ThomasB](https://community.silverfin.com/u/ThomasB)\
**Post date:** [August 16, 2018, 10:07am UTC](https://community.silverfin.com/t/questions-table-not-being-shown-accounts-not-selecting-from-cy-information/1124/1 "2018-08-16T10:07:11Z")

</div>

Hi there

Just recently started using Liquid/Markup, and have 3 questions from the same coding:

1. 
  - When creating tables, sometimes it works, sometimes it doesn’t show as a table correctly (see below)

2. 
  - This is not picking up the actual values in the accounts, instead displaying £0.00

3. 
  - Not 100% whether the $1 is being updated correctly.

Coding:

> {% stripnewlines %}  
> |--------------70%----------  
> |---------30%----------:+  
> {% newline %}  
> |Select account numbers  
> |{% input custom.payroll.gross as:account\_collection range:1\_\_9 accounts\_var:payroll\_gross %}  
> {% newline %}  
> {% for account in payroll\_gross %}  
> |{{ account.name }}  
> |{{ $1+ account.value | currency }}  
> {% newline %}  
> {% endfor %}
> 
>   
> 
> {{ %1 }}  
> {% endstripnewlines %}

This shows the following output:

|————–70%———-|———30%———-:+  
|Select account numbers|  
|Sales|0.00  
|Use of home as office|0.00  
|Insurance|0.00  
|Salary - Directors|0.00  
|Director’s NI|0.00  
|Wages|0.00  
|Travelling|0.00  
|CIPR membership|0.00  
|R&R|0.00  
|Sundry|0.00  
|Accountancy|0.00

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [August 16, 2018, 11:09am UTC](https://community.silverfin.com/t/questions-table-not-being-shown-accounts-not-selecting-from-cy-information/1124/2 "2018-08-16T11:09:48Z")

</div>

Hi @ThomasB,

I have some suggestions for you.

1. I think it’s because the `newline` tag is not properly used; I always add this tag to every new line that presents itself (see my code below)
2. That’s because you write down `{{ $1+ account.value | currency }}` but if you are using a register, you’ll need logic tags (so {% %}). This is the code you’re looking for:

```auto
{% =$1+ account.value %} 

```

Mind the equation mark = as well; if you don’t do that, the value of the account will be saved in the register but it won’t be displayed for each account.

1. It’s not updated because you use `{{ %1 }}` instead of `{{ $1 }}`

I’ve updated your code with this:

```auto
{% stripnewlines %}
|--------------70%----------
|---------30%----------:+
{% newline %}
|Select account numbers
|{% input custom.payroll.gross as:account_collection range:1__9 accounts_var:payroll_gross %}
{% for account in payroll_gross %}
{% newline %}
|{{ account.name }}
| {% =$1+ account.value %}
{% endfor %}

{% newline %}
|
| **{{ $1 }}**
{% endstripnewlines %}

```

Let me know if any of this would be unclear to you; glad to help you forward, and already some nice coding you did!

---

<div class="post-metadata">

**Author:** ![ThomasB](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@ThomasB](https://community.silverfin.com/u/ThomasB)\
**Post date:** [August 16, 2018, 2:04pm UTC](https://community.silverfin.com/t/questions-table-not-being-shown-accounts-not-selecting-from-cy-information/1124/4 "2018-08-16T14:04:29Z")

</div>

Hi Sven

Thank you for the reply.

I’m struggling to identify the requirements for a table, and comparing stripnewlines with the same code, excluding stripnewlines:

> Trial 1
> 
> {% stripnewlines %}  
> |--------------70%----------  
> |---------30%----------:+  
> {% newline %}  
> |Select account numbers  
> |{% input custom.payroll.gross as:account\_collection range:1\_\_9 accounts\_var:payroll\_gross %}
> 
> {% for account in payroll\_gross %}  
> {% newline %}  
> |{{ account.name }}  
> |{% =$1+ account.value | currency %}
> 
> {% endfor %}
> 
>   
> 
> {{ $1 }}  
> {% endstripnewlines %}
> 
>   
> Trial 2
> 
> {% assign $1 = 0 %}  
> |--------------70%----------|---------30%----------:+  
> |Select account numbers|{% input custom.payroll.gross as:account\_collection range:1\_\_9 accounts\_var:payroll\_gross %}{% for account in payroll\_gross %}  
> |{{ account.name }}|{% =$1+ account.value | currency %}{% endfor %}
> 
> {{ $1 }}

From what I can see, the first section and the second section are the same, just with/without stripnewlines formatting.

But running them provides Test 1 in table format, and Test 2 in non-table format.

I’m happy with most of the coding and logic I’ve seen so far, but for some reason I’m tripping up when I try to sort out tables.

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [August 16, 2018, 6:48pm UTC](https://community.silverfin.com/t/questions-table-not-being-shown-accounts-not-selecting-from-cy-information/1124/5 "2018-08-16T18:48:14Z")

</div>

@ThomasB,

Perhaps this post will clear it up for you a little:

> [@CASE: make your code readable with stripnewlines and newline](https://community.silverfin.com/t/case-make-your-code-readable-with-stripnewlines-and-newline/366):
>
> 1. Stripnewlines tag 2. Stripnewlines and tables 3. Newline tag Making sure your code is well structured is very important in every programming language. It builds logic into your code and you will profit from it in many ways: It will help you to understand your code better You won’t make errors as fast When you do make an error, you’ll find if faster It helps other people to understand your code faster 1. Stripnewlines tag Before we go into the newline tag, we’ll have a look at the s…

Don’t feel bad, as I had issues in the beginning as well with this: when I started building templates, there was no such thing and everything had to be structured the way you did for Test 2 (I’m not sure on why you say it doesn’t has a table format? It does, and is perfectly structured like I would’ve done without stripnewlines).

I personally prefer stripnewlines and newlines now, and I continue to work like this with my one rule: a newline is added as soon as a new row is needed.  
So, if you create a table within stripnewlines, you first line of code is not new - you just start with it. If you think of it this way, you should be good to go.  
(of course, you’re not obligated to use this - but just look at our old templates, and you’ll see it can become quite complicated to read the code).

Hope this helps you out a bit?
