المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : String Placeholder/Templating Question



C# Programming
12-17-2009, 07:00 PM
Hi,

I need help to create a colon delimited arbitrary length subfolder-ranging string based on a value. That probably makes little sense, so to demonstrate:

Value: 194356

I was hoping for a function that could take in some arbitrary 'template' definition like this:
##0000 - ##9999:####00 - ####99
and the above Value

and return something like this:
190000 - 199999:194300 - 194399

Likewise, if the 'template' were defined as:
###000 - ###999,

the following would be returned
194000 - 194999

and an even more finely detailed 'template':
#00000 - #99999:##0000 - ##9999:###000 - ###999:####00 - ####99:#####0 - #####9
would return:
100000 - 199999:190000 - 199999:194000 - 194999:194300 - 194399:194350 - 194350.

It also needs to work for different Value lengths, eg:

Value: 5455

'Template':
##00 - ##99

returns

5400 - 5499

The value, and the ranges, always have the same number of digits. I could easily hardcode this definition, but for reasons explained below, I don't want to do that.

Purpose (for any other ideas on how to do what I need to do):

Our Peoplesoft system generates PDF report files into a shared UNC folder. These have the filename: 000#######_.pdf where the 6 hashes represent a 6-digit numeric Vendor ID. I have to upload these files into our OpenText Livelink DM system. The definitions for the upload process (source path, destination, etc.) come from a custom XML file. The need for the sub folders arises from the fact that Peoplesoft generates 100's of reports per week - and shoving them into a single folder in Livelink is not acceptable to the users. If they could drill down by range, they would be happy.
Peoplesoft actually generates different types of report files in different places (Purchase orders, RFPs, etc). Some of these need more fine-tuned filing into subfolders, some do not - hence the need for a generic subfolder creating function.

I appreciate any help with this. If any more information is needed, I should be pretty speedy with the responses.

Adam