How can we have the attachment name appear in the export mode but not in the preview mode?

I used the following code to get the attachment name in the export mode. But this code gives me the name of the attachment 2 times in the preview mode and once in the export mode. My export mode looks good now but my preview mode has the attachment name pop up 2 times. I want it only once in the preview as well. So, maybe there is a way where we can get the name printed on the export but not on the preview. Any help is appreciated.

{% input custom.attachment.[item] as:file assign:link_attach %}{% nic %} {% endnic %}
{% nic %}{{ custom.attachment.[item].document }}{% endnic %}

The screenshot is below for reference.

My preview looks like this.

 Xero error.jpg  Xero error.jpg

My export looks like this:

2020-12-08_8-35-10

Hi Jimsy!

This is caused by your input tag, which it’s content is shown in preview as well. You could add some ic tags around it to only include it in Input View. The downside of doing this, is that it will also affect the variable link_attach you are creating there. So, if you are using that variable somewhere else in your code, it would be useful to define it outside the input (and ic) tags as well.

It could be something like this:

{% ic %}{% input custom.attachment.[item] as:file %}{% endic %}
{% nic %}{{ custom.attachment.[item].document }}{% endnic %}
{% assign link_attach = custom.attachment.[item] %}

Kind regards

Thanks agustin for the prompt reply.

A follow up question on this. Your solution solved my issue of having the name appear 2 times in the preview but it took away the ability of being able to click on the attachment to look at it at the same time. Earlier my preview was showing one as a clickable link and the other as placeholder for the attachment (this was appearing in my export).

image

The blue one in the above image is clickable and the grey one is not. Now, after your solution, only grey one is appearing and the blue one is not. I understand why this would happen. This is because we have added ic tags to our code but just want to find out if there is a way we can keep the clickable link intact and get only one attachment in the preview and in the export.

Hope this makes sense.

Hi @Jimsy,

We understand how you want this functionality to work in preview and export, but at the moment this is not possible.

I’ll flag this to our backend engineers to see what we can do here. Can’t make any promises, but we’ll keep you updated!

Kind regards,
Robin