Create Two variables as shown in figure
One for Fullpath STRING
Another for Validate INT
Step 2:
In script task Editor Select valiadate variable as a Readonly variable and other for Readand write variable
"D:\\ExcelDestination\\ExcelWorkBook_"+ (DT_STR, 4, 1252) DATEPART("yy" , GETDATE()) +
RIGHT("0" + (DT_STR, 2, 1252) DATEPART("mm" , GETDATE()), 2) + RIGHT("0" + (DT_STR, 2, 1252) DATEPART("dd" , GETDATE()), 2)+".xlsx"
In script task Editor Select valiadate variable as a Readonly variable and other for Readand write variable
"D:\\ExcelDestination\\ExcelWorkBook_"+ (DT_STR, 4, 1252) DATEPART("yy" , GETDATE()) +
RIGHT("0" + (DT_STR, 2, 1252) DATEPART("mm" , GETDATE()), 2) + RIGHT("0" + (DT_STR, 2, 1252) DATEPART("dd" , GETDATE()), 2)+".xlsx"
Step 3:
Click on edit script then write like as shown in last image
Save then click OK
using System.IO;
public void Main()
{
// TODO: Add your code here
String str = Dts.Variables["User::FullPath"].Value.ToString();
if (File.Exists(str))
{
Dts.Variables["User::Validate"].Value = 1;
}
MessageBox.Show(str);
MessageBox.Show(Dts.Variables["User::FullPath"].Value.ToString());
Dts.TaskResult = (int)ScriptResults.Success;
}
Go to properties of Fullpath by selecting that variable and click F4---->Expression--->Write expression shown in image Expression Builder--->Evaluate expression
Step 5:
Click on presidence constraint--> Evaluation and Constraint-->@validate ==1
in other line keep @validate==0