PDM, Dispatch and File Move

Hi all

I'm trying to move files via dispatch, but I'm hitting a wall.

Today, our files are saved in three folders that contain all the files of the same type: PLAN, PART and ASSEMBLY (historical architecture for us, and not always practical)

We want to group all the files related to a reference (part, SW and PDF plan , etc.) in a folder named after this reference. For example, a file CP012539.sldprt is stored under a part, along with all the other sldprts. We want to save it in a CP012539 folder, with the CP012539.slmdrw plan, the PDF CP012539.pdf, etc.

Via the dispatch, I can't make this transfer automatic:

Between the classic beginning and end of the block, I inserted the following line:

Source File Path: %PathToSelectedFile%

new path: C:\_COFFRE\PRODUCTION\Left(%NameOfSelectedFile%, 8)\%NameOfSelectedFile%

In theory, Left(%NameOfSelectedFile%, 8) gives me the file ref, extracted from the name of the source file, without its extension, and I figured that by framing it with \, it would turn into a folder.

Then, classically, %NameOfSelectedFile% refers to the name of the source file, which is preserved.

Except that when I launch this task, it moves my source file (so far so good), but without creating a folder, and worse, removing its extension!

 

If I only try to create a folder with similar code, it works just fine.

Pb, I can't transfer files in it automatically (I would have to rewrite the code for each reference....)

Anyone have a tip?

Hello

I don't have PDM on hand at the moment but having struggled a lot with Dispatch you have to break down the tasks as much as possible. First you have to create the folder and then move the file.

You will probably have to manage the folder name via a variable in Dispatch because from memory it has a bit of trouble with text functions (such as left...) nested with other features. I could help you a little more from June 7 if no one has answered by then.

Thank you for your answer.

That's indeed the path I took.

All that remains is to dig how to put everything clean for it to work.

This is the folder name/variable part where I'm less comfortable.

I have attached the code as is. And so it gets stuck after the creation of the folder (that's working).

I want help ;-)


2022-06-07_12_04_10-modifier_laction.png

Hello

In the interface for performing actions, you have to click on variable and declare a variable of type "Static String" (RecupFileName for example) and enter the manipulation on the file name Left(%NameOfSelectedFile%,8).

In the screenshot I don't know if it's normal for the file to be sent to a folder other than the one created, but in any case if the file is not renamed, you have to stop at the folder name, i.e.:

C:\_EVOLIS\03-STUDIES\01-CATALOG PRODUCTS\X20\02-PIECES\%RecupFileName%\

To create a folder, you must enter as follows: C:\_EVOLIS\01-PRODUCTION\02-PIECES\%RecupFileName%

As explained, dispatch does not handle well the accumulation of functions such as manipulating strings in a "static" line, so you have to go through a variable.

1 Like

Damned! It's not working

 

I created the FolderName variable, I modified my code accordingly (correcting the two different paths) and I get an error message (see attachment). However the folder is created well, but it crashes when moving the file (I checked, I have the rights to move the file concerned)

 


2022-06-10_09_06_46-modifier_laction.png
2022-06-10_09_06_58-administration_solidworks_pdm_-__flux_de_travail_-__evolis___wf_cao.png
2022-06-10_09_05_53-02-pieces.png

I also tried to replace the path with a variable, same result: the creation of the target folder is done well, but impossible to move the file.

 

Edit: logged in as an Admin it works! We are on the right track.

 

Edit 2: how can I recover a property of the file to be moved? For example, its description? The idea would be to rename the folder like this: {Target file name} - {Description}, to make it more readable?

Edit 3: ok, found, with a variable. Now I have to place it where I want.... not easy. Finally, I want it to go in the description of the file. I dig, I dig.

Hello

I'm looking at this, there may be a problem with rights right, if it works with the admin account?

Edit: I just looked at the screenshots, to move the file without renaming it, you have to stop at %FolderName%\ and not put %NameOfSelectedFile

As far as the description is concerned, it has to be mapped if you want it to be automatic, otherwise you have to create an input interface to put it in hand.

1 Like

Hello 

Why not use the PDM Tree Move function? 

If the documents are approved, you just have to be under a log admin, or create a provisional state to go from approved to move and then once the files are in  place, a return to approved without changing the version

Another method drag it via explorer when all the files are archived, in this case  one window is in full search in the root folder of the set  and the second window in the destination folder under set.

Sort by name or the Plan Number column, select  and drag everything into the second window. 

This doesn't change anything for PDM, no link loss since the view of the vault is only a pagination. The files are classified differently on the server.

@g.casters: only works for real assemblies. Using this technique does not work if there are virtual subassemblies.

 

1 Like

Thank you both (and sorry for my late reply, I had put this topic aside for way too long.)

I'm trying to make it automatic via a task so that the handling is as simple as possible for users.

The idea is to be able to process all the existing files (more than 3000 references, in different states) so it's difficult to integrate this into a workflow, at least at the beginning.

And I don't even plan to make them one by one by hand... :sweat_smile:

Today my task doesn't work so badly, the folder is created well, with the right name, all the files are in it, but the description of the file won't always be in the description of the folder, and I don't understand why...

Here's what the program looks like today:

2023-02-27 10_20_00-Modifier l'action

With for the variables:

The first two work perfectly.
The last one doesn't work all the time. In any case, it is not always found in the description of the file.
However, the parts to be moved do have a value in Description, and this in all tabs of the map (@ and all configs)

Below is the setting corresponding to the Define the task's card variables line.

2023-02-27 10_13_29-Modifier l'action

I keep digging.

Could it have something to do with the setting of each variable?
In the Admin console, the variables I'm interested in have attributes that apply to SolidWorks formats, but shouldn't they also be linked to folders? And how to do it?

I also tried to change the settings in the maps, but with the only result of crashing the Windows explorer... So I quickly went back to the initial settings...

I just applied the modification following your Edit, it works. Indeed, my files were renamed (without it having any other consequence than a waste of time...)

There is still the mapping of properties, and there I am less comfortable. What I did obviously doesn't work...

Hello
Unless I'm mistaken, folders don't have any type associated with it so they need a specific variable with no mapped attributes.

Well, for the last word, after calling the Solidworks hotline, my program was good, except that I had not specified any configuration in my variable declination...

With the little @ who is doing well, it's much better.

So my macro is functional!!

Thank you to everyone who took the time to respond.

1 Like