Using Pentaho, I would like to update records of database with the value of some of public parameters of the transformation. I know that I can use the value of parameters in some steps such as Table input or Database Join by checking the Replace variable option. However, I cannot find any way to pass value of public parameters of the transformation in order to use in Update step. Can anyone help me with that?
For clarificattion: I want to use the parameter which is defined here
In order to use public parameter of transformation, Get Variable step can be used.
Related
Can I define inside a "select value step" a variable?
like ${column_name}
How can I make it work, I have a parameter that will change this column every time.
That step doesn't allow using variables to select the columns of the stream you want to keep.
In this case you could use Metadata Injection, read Pentaho documentation as well as study the example in the samples folder of your installation on how to use Metadata Injection.
You just need to check the box in the step select values
I would like to know if I can update the parameter values (mainly timestamp) automatically using any SQL query. Please don't suggest me to use Environments, as the value is constantly changing and I need them to be updated automatically when I run.
you may follow these steps to config your parameter:
create a variable, e.g. User::starttime
add an 'Execute SQL Task': specify the connection info and the query. e.g. SELECT STARTTIME FROM TABLE. set the ResultSet to 'Single row'. in the ResultSet Tab map the result name and variable name.
after the 'Execute SQL Task' executed, the variable 'User::starttime' will be set to the SQL result.
use the variable User::starttime as your parameter.
Please go throw below link you can use any query output as veritable.
http://dataqueen.unlimitedviz.com/2012/08/how-to-set-and-use-variables-in-ssis-execute-sql-task/
I am quite a beginner with SSIS packages so bear with me. What I am trying to do:
I have daily files in the format of yyyy-mm-dd_filename_bla_bla.tsv
The date of the file need to be added in the table were I am trying to import it. Currently I am doing this manually with a derived coloumn with the expression: (DT_DATE)(DT_DBDATE)"yyyy-mm-dd"
Is there a possibility to automatically take the file name and only take the date part to import it into the table.
The things I find on the internet is getting the date into the file name, but this is exactly the opposite.
I hope I provided enough information, and anyone can help me out with this problem.
thanks in advance.
If you know the file name then keep that file name in a variable
example let file name be : 01/02/2015_kjh.bgd
then by using derived column use string functions as left(#variable,10)
10-> length of date
then map it to your oledb destination
To update/insert into a table you can use the SSIS SQL Exec task and pass in the variable value (which you know how to get) into the update/insert statement as a parameter. Its not hard just be careful on your settings of parameter names 0.
Here is a detailed description on how to do exactly what you are asking once you have a parameter set up:
How to pass variable as a parameter in Execute SQL Task SSIS?
I have a ForEach loop for importing all available tables in source connection. I am using following user variables for this:
OracleTables of type System.Object for holding all tables from oracle DB
TableName for enumerating OracleTables of type String
set of Boolean variables (e.g. Enable_TABLENAME) one for each table to hold whether that table is to be imported or not.
Now, I want to configure the DataFlow task inside ForEach loop to run iff the value of corresponsing table variable if true. Basically, I want something like:
!#[User::Enable_#[User::TableName]] for Disable property of DataFlow task.
that is, I want to get the Boolean table variable for for current table held by TableName variable.
How can I achive this? Or else, is there any better way to do this? Any pointers would be really helpful.
You can use ForEach Item Ennumerator (you can define your Items in the editor itself) or NodeList Ennumerator (and have your values in an XML file) or ADO.Net Ennumerator ( have your values coming from a SQL table instead).
Essentially I a SSIS pkg with an Execute SQL statement that dynamically writes a REPLACE function based on some table values. (ie REPLACE(REPLACE(Col1,"*","",),"###","")
ExecuteSQL result is put to variable #Cleanse
In my Derived Column conversion Im trying to call #User::Cleanse as an expression in to replace the Value of the Col1 from the DataFlow.
The result appears to be pulling the result of #Cleanse and using it as a string value rather than applying it as the REPLACE function.
When Debugging the #Cleanse value appear to be putting \ in the string, which I dont think should matter as it seems to be appliying this to other values without a problem
The result is that when running out to the CSV this is putting
"REPLACE(REPLACE(Col1" in Col1
"*" in Col2
) in Col3 etc etc
How can I get the Derived column transformation to 'see' the variable as the function, not a string value?
Many thanks in advance
Set the EvaluateAsExpression property of the variable to True.
However, binding variables as parameters to an SQL query using the Variable Mappings pane of the Execute SQL task might be a better solution