Excel file name issue in send mail task using SSIS - ssis

I have a package which is creating a excel file 'ExcelName.xls' and storing in 'E:\Reporting\Delivered_Reports'. Now I have to attach this report using send mail task and send it to given mail id. To achieve this I have configured the send mail task and in Expression Builder, I have selected the below expression:
"E:\\Reporting\\Delivered_Reports\\ExcelName_"+
((DT_WSTR,4)Year(#[System::StartTime]))+
RIGHT("0"+((DT_WSTR,2)Month(#[System::StartTime])),2)+
RIGHT("0"+((DT_WSTR,2)Day(#[System::StartTime])),2)+".xls"
I need file name should be 'ExcelName_20150601' where suffix is the current date. But I recieve file which name is 'ExcelName', which is the origional file name. Can you tell me where I am wrong?
Thanks in advance

It sounds like you are editing the name of the excel file in the email, instead of using a file system task to actually rename the file prior to sending it. You can't rename the file using the send mail task, as far as I know.
Additionally, I would do the date to string conversion in a separate variable in order to make this easier to debug, or even put both values in variables to ease maintenance.
Create a variable "var_today" or something and put this code in it:
((DT_WSTR,4)Year(#[System::StartTime]))+
RIGHT("0"+((DT_WSTR,2)Month(#[System::StartTime])),2)+
RIGHT("0"+((DT_WSTR,2)Day(#[System::StartTime])),2)
Then your expression becomes:
"E:\\Reporting\\Delivered_Reports\\ExcelName_"+
#[User::var_date]+".xls"
Do the same for the root directory.

it is better to make the filename you wanted while you are generating from the package.
you cant change the name while sending and put your filename in a string variable instead of writing it directly.
#[User::File_Name]+#[User::date]+".xlsx"
something like this

Related

SSIS/SSDT 2015 Formatted Send Mail Body

I've created a very simple package that loops through folders (and subfolders), retrieving a list of files that exist and compiling them into a variable called str_AllFiles. The ForEach loop does its thing, the script task to compile the string does its thing, and when it's all said and done the Send Mail task does its thing. Everything works just fine...except that the resultant email that's generated comes out as hyperlinks to the actual files instead of just directory/file names. The directory/file names are present, but they are all hyperlinks to the files themselves.
Is there any way to reformat the string variable or the Send Mail message source so that it's plain text? I've seen some suggestions to use a script task to send the email as HTML, but when using that (from here: http://microsoft-ssis.blogspot.com/2013/08/sending-mail-within-ssis-part-2-script.html), but I keep getting an exception error that I can't track down when coding this. To be fair, I'm hard-coding the FROM, TO, and SUBJECT when using the HTML version, which may very well be the issue here.
Any ideas on this? How do I transform the message source so that it's plain text and not a page of hyperlinks?

SSIS Reuse Dynamic Flat File Desitination Filename

I have an SSIS package that creates a text flat file from data in a database table. Everything works perfect except that I need to capture the dynamic filename for use in another process. I've searched everywhere but haven't found anything close to what I need other than using a ForEach Loop to loop through the directory the file will be stored in. I can't do that because there's too many things that could go wrong. I'm currently creating the dynamic filename through variables and it contains a datetime stamp.
Is there a way that I can capture the file name when the file is created in the data flow task so I can use it in another process within the control flow task?
Thank you in advance!
John

Totally new to Talend ESB

I'm completely brand new to Talend ESB (not so much Talend for data integration, but ESB totally.)
That being said, I'm trying to build a simple route that watches a specific file path and get the filename of any file dropped into it. Then it will pass that filename to the childjob (cTalendJob) and the child job will do something to the file.
I'm able to watch the directory, procure the filename itself and System.out.println the filename. but I can't seem to 'pass' it down to the child job. When it runs, the route goes into an endless loop.
Any help is GREATLY appreciated.
You must add a context parameter to your Talend job, and then pass the filename from the route to the job by assigning it to the parameter.
In my example I added a parameter named "Param" to my job. In the Context Param view of cTalendJob, click the + button and select it from the list of available parameters, and assign a value to it.
You can then do context.Param in your child job to use the filename.
I think you are making this more difficult than you need...
I don't think you need your cProcessor or cSetBody steps.
In your tRouteInput if you want the filename, then map "${header.CamelFileName}" to a field in your schema, and you will get the filename. Mapping "${in.body}" would give you the file contents, but if you don't need that you can just map the required heading. If your job would read the file as a whole, you could skip that step and just map the message body.
Also, check the default behaviour of the camel file component - it is intended to put the contents of the file into a message, moving the file to a .camel subdirectory once complete. If your job writes to the directory cFile is monitoring, it will keep running indefinitely, as it keeps finding a "new" file - you would want to write any updated files to a different directory, or a filename mask that isn't monitored by the cFile component.

Dynamic Flat File Connection to import new file everyday

I have to create a job which imports data from .csv file into database table everyday. I have created the job and it works fine as long as the filename is same.
The file that comes in everyday has a different name, so i am trying to set up dynamic flat file connection. As i have only one file to load everyday i am not trying to use For Each Loop Container and also, i am not good at script task.
I was trying to see if there is any other way to achieve this using SSIS.
I have created a variable for my path "C:\Daily Files\" as #[User::MyFilePath]. I am then using this variable in the ConnectionString Expression property of the Flat File Connection Manager.
But it does not work. I get an error saying the Cannot open the datafile.
Can someone tell me what am i missing here?
If you need to create a connection manager to a file that changes name everyday, you will have to write some kind of expression to do so. On the other hand, the easier way out is to use the For Each Loop container as it does not care what the name of the file is as long as you give it *.csv in the qualifying field.

Report saved file as parameters name

I have a report that is going to be saved as .doc or .pdf, my boss wants the name of this file to be saved as the parameters name [it could contain multiple values], but he chooses the file format.
how can I get this done in reporting services?
thx!
You can't from Report Manager whihc is where I suspect you mean
You'd have to wrap a call to ReportServer using SOAP, passing in parameters externally, and renaming in your wrapper. The wrapper would be ASP.NET or WinForms or such.
Alternatively, you may be able to have a custom renderer.
Edit: what your boss asks isn't always possible, even for your boss...
override or handle render method and customize the file name based on parameters provided