Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
JacobJones
Creator
Creator

How to insert today's date into a string in the load script

I am trying to load a new file every day. The file name is the same each day except for where today's date is.  I can insert Billing, and I can insert dateInText, but what I want to do is insert newT where dateInText is.

 

set Billing = '[lib://Billing]';
let t = Date(Date#(today(0)-22, 'M/DD/YYYY'), 'YYYYMMDD');
set newT = Text($(t));
let dateInText = '20200324';


Billing:
For Each File in FileList('$(Billing)/DataExport_Sales_$(dateInText)_050359.csv')

 

How can I get this to work? Or, is there a better way to achieve this?

Thanks for your attention

1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III

I would think just referencing the variable t would work:

Billing:
For Each File in FileList('$(Billing)/DataExport_Sales_$(t)_050359.csv')

View solution in original post

5 Replies
jwjackso
Specialist III
Specialist III

I would think just referencing the variable t would work:

Billing:
For Each File in FileList('$(Billing)/DataExport_Sales_$(t)_050359.csv')

JacobJones
Creator
Creator
Author

That was the first thing I tried, but it doesn't work. 

jwjackso
Specialist III
Specialist III

Put the '$(Billing)/DataExport_Sales_$(t)_050359.csv' in a text box expression.  At the bottom of the expression editor you should see how the $(t) is being expanded.

JacobJones
Creator
Creator
Author

When I use 't' it runs but doesnt return anything.

In Variable t has the value 20200525, without quotation marks. If I put 20200525 in as text it will return the file.

 

JacobJones
Creator
Creator
Author

I'm sorry Ive realized there is a different kind of incrementing happening elsewhere in the file name.

Thank you very much for replying