I have a folder with 12 files that look like this
Also, I’ve already got a data table(dt_names) that looks like the following
How do I extract the date of the 12 files and write it into each column of my existing data table, so it would look like this?
Names 202201 202202 202203 … 202212
Hi @Andrew1213, welcome to the Community.
Use Assign activity & get the file names in an array:
fileNamesArray = Directory.GetFiles(“Folder Path in which 12 files are located”)
Iterate through each array element by using ForEach activity.
Inside the loop, use the regex to extract the numeric values & store it in a string variable:
currentMatch = System.Text.RegularExpressions.Regex.Matches(inputString, pattern)
Inside the loop, after the above action, use Add Data Column to add the columns. In each iteration, the column will be added.
Hope this helps,
Thank you for your reply!
May I know more about step3. as it keeps showing these two errors
- Option Strict On disallows implicit conversions from ‘Integer’ to ‘String’
- Option Strict On disallows implicit conversions from ‘Integer’ to ‘RegexOptions’
*for the fileNamesArray in step 1, I’ve set the variable type to “system.string”
How about the following sample?
Sample20230322-5L.zip (65.7 KB)
It works perfectly! Thank you so much
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.