Repository navigation
|
I am trying to do some dynamic flattening, and the only issue I cant get around, is that there are some characters I am replacing, that may appear at the ends and inside the string, so I am not able to stop my macro from creating trailing underscores eg: |
Replies: 3 comments
|
Jinja is Python under the hood, so you can use Python string methods directly on the value. Add {{ row.replace(".",'') If leading underscores can also appear (e.g. the value starts with a replaced character), add If this is for generating column or alias names, an even cleaner option is the |
|
Just a friendly follow-up — if my earlier answer helped resolve your issue, feel free to mark it as the accepted answer. Thanks! |
|
Hi I havent worked in that team in over 2 years but I will let them know.
Thank you.
…On Tue, Aug 18, 2026 at 7:58 AM Juan Pablo Gómez Veira < ***@***.***> wrote:
Just a friendly follow-up — if my earlier answer helped resolve your
issue, feel free to mark it as the accepted answer. Thanks!
—
Reply to this email directly, view it on GitHub
<#10821>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM4DNLIEGHJUA4CJIEDJ4VD5KN5Z7AVCNFSNUABGKJSXA33TNF2G64TZHM2TGNJUHA4DMNZ3IRUXGY3VONZWS33OHM3TENZUGU2DJILWAI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Jinja is Python under the hood, so you can use Python string methods directly on the value. Add
.rstrip('_')at the end of your chain — it removes any number of trailing underscores, which is exactly what yourreplace(...)calls leave behind:{{ row.replace(".",'')
.replace(".",'')
.replace(" : ",'')
.replace(":",'')
.replace(",",'')
.replace("?",'')
.replace("-", '')
.replace('/', '')
.replace('(','')
.replace(')','')
.replace(' ', '')
.replace('','')
.replace('','')
.upper()
.rstrip('') }}
If leading underscores can also appear (e.g. the value starts with a replaced character), add
.lstrip('_')as well. Note thatrstrip/lstripoperate on the string as a whole, so they're safe to use aft…