Get the connection absolute path

Post Reply
AA5MC
Newbie
Posts: 9
Joined: Wed Jun 21, 2017 8:38 pm

Get the connection absolute path

Post by AA5MC »

Hello I have a script that has three out connection

I like to be able to get the out connection absolute path
for example:
if I loop through my connection I like to get the out folder location on disk

Code: Select all

let OutConnections: Connection[] = flowElement.getOutConnections();

 for (const connection of OutConnections) {

            if (job.isFile() === true) {

                job.log(LogLevel.Info,[Connection path on disk]);
                job.sendTo(connection);
            }
        }

I can't find anything on how to achieve this?
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Get the connection absolute path

Post by freddyp »

Why do you need this? By using sendTo like you are doing the output job ends up in the correct location. Displaying the location in a message does not really add value.

For input jobs you can get the path because there it makes sense: you may have to read the job input file or search for something in a job input folder.

Side remark: testing if a job is a file inside the loop is not efficient because it is always the same condition with the same result, but perhaps this is just part of a test.
AA5MC
Newbie
Posts: 9
Joined: Wed Jun 21, 2017 8:38 pm

Re: Get the connection absolute path

Post by AA5MC »

I want the file count of the directory after a file is sent.
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Get the connection absolute path

Post by freddyp »

The sendTo functions are not executed immediately. There can be multiple of them in a script and they are all gathered until the end of the script. Suppose you had access to the path of the outgoing connection and there were no files in the folder. Testing the number of files in the outgoing folder after a send, even multiple ones, would always return 0.

Do not misunderstand me, I am not saying that having access to the outgoing folder path cannot be interesting: "Hold job" has some interesting functionality that relies on that knowledge, but in that case the number of files is checked before sending. I still do not see the use case for knowing how many files there are after sending. There is perhaps an alternative way of achieving the same goal, but then you will have to describe what the goal is.
Post Reply