Skip to main content
Solved

Create report with dynamic file name (filepath error)

  • December 12, 2024
  • 4 replies
  • 94 views

sven.neuteboom
Rookie
Forum|alt.badge.img

Hello!

I want to create a report with a dynamic title containing the date. I saw this post: Create report with dynamic file name | Thinkwise Community, and followed the steps proposed, but I get the following error: 

It seems like it does not just sets the filename to the value specified in the default, but the entire path. How can I keep the path the same (in user’s documents folder), while setting only the filename? 

Best answer by Edo Spijker

Hello Sven,

To only replace the filename in the whole path you can do something like first extracting only the directory and then placing your own filename at the end.
Extracting the directory can be done with something like this:

LEFT(FilePath, LEN(FilePath) - CHARINDEX('\', REVERSE(FilePath))) 

This searches for the last ‘\’ and removes everything after (and including) that.

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

4 replies

Renée Evertzen
Moderator
Forum|alt.badge.img+4

Hello Sven,

It's been a while for me personally since I have attempted anything in a situation like this one.

I assume you have already implemented a default that creates the ‘testnaam.pdf’ file for the report, judging from your screenshot. Have you tried including the path in the default? I am not entirely sure whether this works or not, and I also don't have any working examples to inspire me, unfortunately. But it might be worth a shot. If not I can ask around to find out if there's someone who knows more about this than me 😅

@Erwin Ekkel Do you perhaps have some additional insights?

Kind regards,

Renée


sven.neuteboom
Rookie
Forum|alt.badge.img

@Renée Evertzen Hi Renée! The problem with hardcoding the path in the default is that the path is dependent on the user logging in, as it has the name of the user in it. So I'd prefer if there would be another option where you only have to specify the filename.

Kind regards,

Sven


Renée Evertzen
Moderator
Forum|alt.badge.img+4

Well technically you do know which user is currently logged in in the default procedure. Perhaps you can fix it through that?

Otherwise I am afraid I will have to tell you that the goal you're trying to achieve might not be possible, at least not currently.


Forum|alt.badge.img+1
  • Moderator
  • 89 replies
  • Answer
  • January 16, 2025

Hello Sven,

To only replace the filename in the whole path you can do something like first extracting only the directory and then placing your own filename at the end.
Extracting the directory can be done with something like this:

LEFT(FilePath, LEN(FilePath) - CHARINDEX('\', REVERSE(FilePath))) 

This searches for the last ‘\’ and removes everything after (and including) that.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings