2

How to add the current project path in Print Composer? doesn't quite do what I am hoping for as it gives the whole filepath (which the client doesn't need/want to see) - is there any way of just getting the last few folders?

At the moment, using
[%concat ( @project_path, @project_title )%] I get this:

/media/jonathan/3C5VCG82K32FDB/Data/GIS/Projects/0020_Client/0019_Mynameforclientproject/Projects/QGISProjectfilename.qgs

when I just want

/0020_Client/0019_Mynameforclientproject/Projects/QGISProjectfilename.qgs

Is this possible?

  • I used the hyperlink markup widget & it made the "1" as a link – user3418765 Mar 23 '17 at 12:29
  • I did it a much easier way by just including the link which expands to the question title. – PolyGeo Mar 23 '17 at 12:33
3

[% @project_path %] is what you need to start with. Not sure why you use @project_title too.

You can use all the String functions to adjust the path to what you need. For example left, right, length, strpos and substr.

Depends what exactly you want. Let's say your folder structure always contains "/Data/GIS/Projects" which is the end of part you want to cut off. In that case this expression will give you only what follows after:

 [% right(@project_path,length(@project_path)-(strpos(@project_path,'/Data/GIS/Projects')+length('/Data/GIS/Projects')-1)) %]
  • Good to know that all the string functions can be applied to this. I jsut constructed it in the expression editor when I added the @project_title - it still gives path & filename only once though. – user3418765 Mar 23 '17 at 13:07
  • ...@project_title is project title, it has nothing to do with file name. You can set project title under "Project/Project Properties...". By default it is empty string. If you are after file name it is @project_filename. – Miro Mar 23 '17 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.