Set DelayValidation property using EzAPI - ssis

I am using EzAPI to build an SSIS package.
FlatFileSource -> DerivedColumn -> ODBC Destination.
But I can't find where to set the Delay Validation property to true. It's not letting me do so in the EzPackage or EzDataFlow objects.

In Visual Studio, the DelayValidation property may be set for a FlatFileSource, but there is no DelayValidation property available for either a DerivedColumn component or an ODBCDestination. On which object do you want to set the DelayValidation?

I was able to set it by casting the EzDataFlow object to a Microsoft.SqlServer.Dts.Runtime.TaskHost object
EzDataFlow dataFlow = new EzDataFlow(Package);
((Microsoft.SqlServer.Dts.Runtime.TaskHost)dataFlow).DelayValidation = true;

Related

Where is setting for RetainSameConnection stored?

RetainSameConnection property on project-level connections.
If I change to true (from default of false) and choose not to save the package file I used to make the change then the setting will be retained but none of the files in source control have changed. Where is this value being stored?!
Value is stored even after closing/reopening VS and restarting machine.
Also:
If you specify RetainSameConnection=true at the project-file level (.dtproj) the RetainSameConnection property drop-down (viewed via Properties tab) in VS will show false but the behaviour will be true. While I would expect behaviour to be true it's misleading that the drop-down value doesn't conform & I'd like to understand why it doesn't.
If you create a boolean project param with value of true & parameterise RetainSameConnection property of the project connection then behaviour will be true and you can no longer change the value of the drop-down. This is exactly what I'd expect.
If you edit and save the connection properties it will set DTS:Retain="True" on the conmgr file. This again doesn't cause the drop-down value to change. haven't experimented with this as am losing the will slightly.

Unable to use expression on excel connection manager in SSIS 2017

I'm trying to loop through excel files in a directory and perform a data flow task in SSIS.
The For-Each Loop container seems pretty simple to set up:
I map to a variable called FileNameTemp.
Inside the For-Each Loop, I have a data flow task where the source object is an Excel Source with an Excel Connection Manager. I use the FileName temp to set the File Name of the ExcelFileName:
My problem is whenever I try to run the package, I get the error below:
[Connection manager "Excel Connection Manager"] Error: SSIS Error Code
DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code:
0x80004005. An OLE DB record is available. Source: "Microsoft Access
Database Engine" Hresult: 0x80004005 Description: "Failure creating
file.".
I found other similar posts. I definitely have permission to write to this folder. If I remove the expression and just open the same file over and over it works. I also set DelayValidation to true on pretty much every level.
Try removing the "C:..." from your expression definition. The For-Each file enumerator will give the full path.
In the future you can set a breakpoint on your data flow task and view the value of your variable that you set in the locals tab.
Same answer, just more verbose than #mike Baron's answer is that in the ForEach Loop Container, the radio button is checked for "Fully Qualified" with the result pushed into our variable #[User::FileNameTemp]
Each file found in the specified source folder C:\SourceCode\ExcelSourceFinancialReconcilliation is in turn going to be assigned to that variable in the form of
C:\SourceCode\ExcelSourceFinancialReconcilliation\file1.txt
C:\SourceCode\ExcelSourceFinancialReconcilliation\file2.csv
C:\SourceCode\ExcelSourceFinancialReconcilliation\file2.xls
Then, when we set the Expression on the Excel Connection Managers ExcelFilePath property, we need to just use #[User::FileNameTemp] As it stands, the expression is doubling up the path so that Excel is attempting to find
C:\SourceCode\ExcelSourceFinancialReconcilliation\file1.txt\C:\SourceCode\ExcelSourceFinancialReconcilliation\file1.txt
As a general rule, only use a direct variable in the Expressions associated to "objects" in SSIS. Property1 = #Variable The reason for this, is that you cannot put a break point to on the evaluation to determine why #Property1 = "Foo" + #Variable is invalid. If you create a custom variable #Property1Variable = "Foo" + #Variable and then assign #Property1 = #Property1Variable, you can put a breakpoint in the package and then inspect the value of the SSIS variable. It's much easier to find problems this way.
Possibly helpful other answers on the subject
https://stackoverflow.com/a/18640174/181965
https://stackoverflow.com/a/21536893/181965

SSIS Setting the HasSideEffects property

I am calling a stored procedure in a data flow task that outputs a value that is not being used. Because its not being used the optimizer removes the component during runtime. It states I can override this by setting the 'HasSideEffects' property to true but I don't see where to set this. I see it in the 'Input and Ouput Properties' of the OLE DB Source but its read only.
Turns out that I had set the 'RunInOptimizedMode' property to true and that was causing the issues. Set it to false and I am good to go

ExcelConnection manager dynamic file path in SSIS

When i tried to give connection string in the form of a variable to "Excel Connection Manager", it gives me the below error.
the connection string format is not valid. it must consist of one or more components of the form x=y seperated by semicolons. This error occurs when a connection string with zero components is set on database connection manager.
Since you want a dynamic file path, when you are setting up the Expression for the Excel Connection Manager, you are probably selecting ConnectionString as a property in the Property Expressions Editor. This results in the error you specified in your question.
What you actually need to select is the ExcelFilePath property. Add your variable in the Expression field afterwards as you would normally do.
You should give us more information. What's the value of you variable when the error pops up? To exactly what property have you assigned this variable?
Anyway, I suspect that you didn't set [Delay validation] property of your connection manager to True - without it ssis check if you connection manager is ok, before you even assign value to the variable (which is dynamic and happens during execution in some loop, I suppose).

SSIS set result set from data flow to variable

Before I give myself some sort of stress related heart attack.
Would anyone know how to complete the seemingly simply task of setting the result set of one data flow task (the result will be either a 0 or 1) and assigning that value to a variable.
I've created the variable ok.
The result set comes from an XML file with multiple elements. The flag (0 or 1) is the result from one of those elements, so I also need to know how to get the result set to be just that flag.
If anyone could help I would really really appreciate it.
Update : I eventually read the result (0,1) back to SQL Server into a flag table. Then used a Execute SQL script to read it back from SQL Server and to a variable. Not sure if this is the best way to have done it but it seems to have done the trick.
You can use a Data Flow Script component to transfer a data flow column value to an SSIS variable. However, you must follow certain rules when working with the Data Flow Script component and SSIS variables.
SSIS doesn't allow you to assign values to SSIS variables in the script procedure that processes rows. But there are pre- and post-execute procedures where you can handle the assignment.
In your Script component, add the SSIS variable to the ReadWriteVariables property. Edit the script and declare a variable in the ScriptMain class. Use the PreExecute procedure to initialize the variable. Use the ProcessInputRow procedure to assign the input -buffer column value to the script variable. And, use the PostExecute task to assign the value from the script variable to the SSIS variable.
Here's an example VB script component. It has an SSIS variable (MyOutVariable) that will get the output of the script variable (MyVar). The MyVar variable gets it's value from the MyNumber column in the data flow.
Public Class ScriptMain
Inherits UserComponent
Dim MyVar As Integer
Public Overrides Sub PreExecute()
MyBase.PreExecute()
'initialize variable local to data flow
MyVar = 0
End Sub
Public Overrides Sub PostExecute()
MyBase.PostExecute()
' output variable value to SSIS variable
Me.Variables.MyOutVariable = MyVar
End Sub
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
' logic to get value
MyVar = Row.MyNumber
End Sub
End Class