Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
I need some help with load scripts. I have a standard load script loading some data from excel ,and i try to set the year for a specific file , but something is wrong.
When the "Test(opened)2014-01-01-06-00-26.XLS" was loaded the "year_test" field should be '2013' , but always show 2014
if(
(FileBaseName()='Test(opened)2014-01-01-06-00-26.XLS')
,'2013',
Year(Date#(left(subfield(FileBaseName(),')',2), 10), 'YYYY-MM-DD'))
) AS year_test,
Can you help me with this issue?
Thanks in advance
Hi,
It return 2014 is correct. Because FileBaseName() will return Test(opened)2014-01-01-06-00-26
You can use
if(
(FileBaseName()='Test(opened)2014-01-01-06-00-26')
,'2013',
Year(Date#(left(subfield(FileBaseName(),')',2), 10), 'YYYY-MM-DD'))
) AS year_test,
Regards,
Sokkorn
Hi,
It return 2014 is correct. Because FileBaseName() will return Test(opened)2014-01-01-06-00-26
You can use
if(
(FileBaseName()='Test(opened)2014-01-01-06-00-26')
,'2013',
Year(Date#(left(subfield(FileBaseName(),')',2), 10), 'YYYY-MM-DD'))
) AS year_test,
Regards,
Sokkorn
Load * from Test(opened)2014-01-01-06-00-26.XLS;
FileBaseName() -> Return Test(opened)2014-01-01-06-00-26
FileName() -> Return Test(opened)2014-01-01-06-00-26.XLS
Thank you very much Sokkorn!!