Book a Demo

Author Topic: Environment Variable to define path to linked files.  (Read 7779 times)

tderosa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Environment Variable to define path to linked files.
« on: January 23, 2018, 07:52:25 am »
Is there any way to use an environment variable in defining the path to a linked file? Here is my intent:

To deliver an EA model in a folder which also contains a folder that will hold background documentation that can be linked to elements in the model.  Rather than an absolute path, I'd like to use an environment variable to define the base folder of the docs.  I saw someone asked this same type of question back in 2012, but with no answers.  How about today in 2018?

VKN

  • EA User
  • **
  • Posts: 187
  • Karma: +9/-1
    • View Profile

tderosa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #2 on: January 24, 2018, 01:33:02 am »
Thank you for your response.  Unfortunately, this doesn't seem to work.  Perhaps it's only for linking source files.  In the drop down it does have a "linked file" as a type option, but it doesn't work.  Only when the full path is used will the launch of the file be successful.

tderosa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #3 on: January 24, 2018, 01:49:01 am »
Is there a log file that I can look at to see what might be happening when I click the launch button? 
Maybe I didn't understand the instructions of the link you sent me.

I got to the manage paths, and created a variable VAR with the path C:\somedir.

Then in the properties of an artifact element, I selected files and listed the path as %VAR%\someFile.docx

I would expect that selecting this file and pressing the launch button, the file would open.  It only works when I have the full path C:\somedir\somefile.docx.  I also tried this as a hyperlink in the notes section of the element and it also did not work.

Originally, I tried it with a "real" system environment variable which also didn't work.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #4 on: January 24, 2018, 04:05:03 am »
There are different ways to create linked files. Which one did you use?

q.

tderosa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #5 on: January 24, 2018, 04:14:19 am »
I dropped each type of artifact element on a diagram, opened its properties, selected file, and added the path to the file.  When I add an entire path, I can select that path and select the launch button and it opens the file.

I have seen that you can double click on one of the document based element types and it opens a document that you can edit.  But what I'm trying to do is link existing documents.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #6 on: January 24, 2018, 07:54:17 am »
I don't think that this is sensitive to the local path settings. I remember that it has been asked this to be a relative path. But that's also not possible (if I'm not completely wrong here). However, you could write a script or an add-in that looks into the contents of those linked files and do some magic (e.g. recognize a keyword in the beginning and replace it with something which makes up the real path).

q.

VKN

  • EA User
  • **
  • Posts: 187
  • Karma: +9/-1
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #7 on: January 24, 2018, 11:06:45 am »
I also tried this as a hyperlink in the notes section of the element and it also did not work.
Just checked that it works with hyperlinks. I have also tested by moving the file to different location then updated the local path to that new location and then clicking the hyperlink opened the file.

PeterHeintz

  • EA Practitioner
  • ***
  • Posts: 1000
  • Karma: +58/-18
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #8 on: January 24, 2018, 07:05:13 pm »
Hi,
When you use "Local File" as Type in the File dialog, EA points to the file system wherever it is. If it is on your local drive only you or better your machine can follow that link.
When you use Web Address" as Type anyone having access to web address can follow that link.

There is a third option.
When you drag e.g. a word file from MS Explorer and drop it with ...(internal) to a EA diagram, an EA element is created where "File Path" in the "Files" dialog is pointing to nothing. However, when you or any other user, clicks on that element you will see word opening that file.
It is not the file in your file system you dragged, but a copy store in the EA-Repository.


Best regards,

Peter Heintz

tderosa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #9 on: January 25, 2018, 04:13:22 am »
Thank you Peter.  I was able to get the web addresses to work, but I guess that using an environment variable for the path is just out of the question.  It doesn't expand it for external documents.

However, your suggestion of just dragging and dropping the docs onto a diagram worked out fine.  Thank you very much.

PeterHeintz

  • EA Practitioner
  • ***
  • Posts: 1000
  • Karma: +58/-18
    • View Profile
Re: Environment Variable to define path to linked files.
« Reply #10 on: January 25, 2018, 07:09:05 pm »
I remember that I looked also for something like that or similar, but I did not found a solution.

Because of that I moved my data to a central network storage to use absolute paths.
Best regards,

Peter Heintz