04-29-2017 12:19 PM
I have a program that dynamically creates folders for a select group of customers utilizing the "dcreate" function (the folders need to have a naming convention of "Doe, John".)
I subsequently need to populate reports in those folders for each customer. However, in order to do so, I need their customer ID. Up until now, I have created a lookup table that contains both the customerID and the corresponding folder location. So when I run a report that generates a PDF, the program will know for customerid X that the PDF needs to be placed a location Y.
However, managing the look up table has been problematic due to our need to add/remove folders from time to time.
Is there a way for me to store the customerID within the windows folder properties? That would enable me to connect the customerID to the folder location without the need of an additional look up table. I could then - hopefully - use the DINfo function to pull the customerID associated with the physical folder.
Does this ring a bell to anybody? Any ideas?
04-29-2017 03:40 PM
Have you considered saving the PDF repoprts in a Folder/CusomerID subfolder ?
You wrote: "the program will know for customerid X that the PDF needs to be placed a location Y."
What information do you hold in "Y" subfolder name ?
You may consider use Folder/CustomerId/Y or any other combination.
04-29-2017 09:16 PM
It would be much easier on Unix filesystem. You could create one set of folders using NAME and another as symbolic links using the ID. THen the program that is writing the files and only has the ID value could write to a folder based on the ID value and it would show up in the folder based on the NAME value.
data lookup ; infile cards dsd dlm='|' truncover ; input id name $40. ; cards; 1|Doe, John 2|Smith, Mary ;
So your program to create the directory folder could run these Unix commands.
cd /top_level mkdir -p "by_name/Doe, John" mkdir -p "by_name/Smith, Mary" mkdir -p by_id cd by_id ln -s "../by_name/Doe, John" 1 ln -s "../by_name/Smith, Mary" 2
Then the program that writes the files could generate the name using the id and the people/programs that look for them by name will see them.