If your file includes a date in the file name but not in the file itself, you can extract the date field from the file name and use it as the date field.
Required Editions
| User Permissions Needed | |
|---|---|
| To extract a date from a file name: | Admin |
- From the Connect & Mix tab, select Data Streams, and then Data Streams List
- Click Create New, and upload your file.
- In the Map to Model window click Date to add a date field.
-
Click the formula editor icon across from the date field and apply a formula.
Here are some examples of formulas you can use to extract a date from the file name.
PARSEDATE(RIGHT(env['filename'],10),'MM-dd-yyyy'). The RIGHT function takes the indicated number of characters starting on the right of the text referenced. PARSEDATE(EXTRACT(env['filename'],'_',1),'MM-dd-yyyy'). The EXTRACT function obtains a substring from the string you referenced, according to a delimiter and position. The delimiter is the separator between the parts of the string, and the positions are the different parts sectioned by the delimiter. PARSEDATE(SELECT(env['filename'],'\\d{2}-\\d{2}-\\d{4}'),'MM-dd-yyyy') The SELECT function obtains a specific sub string from the string you referred to based on specific characters or patterns. The function supports the use of multiple regular expressions. In this example, a regular expression is used and this pattern is retrieved: ##-##-####—2 digits, hyphen(-), 2 digits, hyphen, 4 digits. The 'd' in the syntax refers to digits, and the number in the brackets {} indicates the number of digits. The delimiter is stated according to its location in the pattern. You can use the select function syntax and change the delimiter and the number of digits in every position in the pattern according to your data. Only use the select formula if you’re familiar with the use of regular expressions.