Slice Delimiter?

in my chart of accounts we have numbering in order to series accounts. see image below.

the problem is when i pick account in journal entry, of course the number is inluded.

how can i remove the number in my print format?


this is my print format how can i remove the number?

I have used Python’s built in string slicing to manipulate things like this in my print formats.
There are a bunch of tutorials on it in different presentation formats so you can choose your favorite. Google python string slicing tutorial.

{% set b = “1-2-3-4-5”.split(“-”)[1:] %}
{{ b|join(“-”) }}

// 2-3-4-5

Edit: sorry I’m using mobile so cannot have proper answer. Hope it helps.


{% set account_number = d.account.split(" - ", 1)[0] %}
{% set account = d.account.split(" - ", 1)[1] %}

{{ account_number }}
{{ account }}

1 Like

That’s probably easier to understand and explain than counting the places from the front of the string to where you want to slice off. The straight up slicing is probably faster but also totally irrelevant in this use case.