Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a data set that I am unable to link up to a date apart from with the file name. The file name in this case is named SHIP_Night_Week2.xls for each week etc. I need to change it to just 2 so need to trim either sides and all of the text from it. Is that possible?
Hi Kathryn,
Here is a method.
=TextBetween('SHIP_Night_Week2.xls','Week','.xls')
Hi Kathryn,
could you give more information or screenshot, what do you expect to achieve?
Beck
Hi Kathryn,
Here is a method.
=TextBetween('SHIP_Night_Week2.xls','Week','.xls')
Or
=Replace(SubField('SHIP_Night_Week1212.xls','Week',2),'.xls','')
Or this one:
=KeepChar('SHIP_Night_Week965123.xls','0123456789') & '.xls'
How can I use this in the script to load for each file? As currently SHIP_Night_Week is loaded in as a wildcard with many different weeks?
I'm not sure I understand.
If you mean that you want a link field to some other WeekNr field, just create it during your load. Like in:
LOAD ...
KeepChar(FileName(), '0123456789') AS WeekNumber,
...
FROM [*.xls] (options);
How can I use this in the script to load for each file? As currently SHIP_Night_Week is loaded in as a wildcard with many different weeks?
In that case, you can try something like
Load *,
Textbetween(FileName(),'Week','xls') as Filename
From
....
OR
Load *,
Replace(SubField(FileName(),'Week',2),'.xls','') as Filename
From
....