Serial numbered files depending on project folder

Hi, we are i the middle of implementing EPDM, so go easy !

I have created an R&D workflow  and I have added a folder template, to create any folder within the R&D workspace to be automatically given folder name according to serial number

eg R&D001

What I am looking to do, is create solidwork parts which are also given serial number, but reference the folder they are created in

eg

R&D001 \ R&D001-00012.prt

I have 2 serial number variables...R&D Project Number, and R&D Part Number

It is half working, but what is happening, is any new part is taking the next sequential part number, AND the next sequential Project number, irrespective of where the part is created, or even if the project exists.

So my question is, how do I tell the part template to reference the project number serial (where the part is being created) rather than just increasing the counter?

Thanks guys

SolidworksSolidworks Pdm enterprise Pdm