Using environment variable With Post/Session? - etl

I'm using the environment variable $PMTargetName#numAffectedRow, but the TargetName is a parameter(parfile)
I'm trying to do this way:
$PM$$SOURCE_TABLE#NumAffectedRows
Is not working :/

What you need to use here is the name of the Target Transformation, not the table name. So assuming you've got a Target Transformation named MyTargetTable and you use the Target Table Name property to set the actual table name to e.g. Customers, then:
$PMMyTargetTable#TableName should give you Customers
and $PMMyTargetTable#NumAffectedRows should get you what you're looking for

The variables to be used in pre/post session commands need to be passed to the session from parameter file. e.g. $PMTargetName should be used in your session e.g. as Target Table Name. If you are doing this, then this will work - ${PMTargetName}#numAffectedRow. Adding parentheses will ensure your variable is expanded before #numAffectedRow is appended to it.
If you are not using $PMTargetName anywhere in your session then IS will not expand it. You should declare it as your workflow variable. And since you have already defined it in parameter file...rest should work.

Related

Thymeleaf: Building variable names dynamically

I am trying to build the name of a var dynamically by concatenating the value of a variable and adding some string afterwards, as I add these variable in runtime. Something like the following should work but it does not.
th:text="${__#{myClass.getA().getB()}+'-result'__}"
Is this even possible to do? I dont know the name of the variable, I can only construct it like this unfortunately.
Yes, that is possible, Thymeleaf supports expression preprocessing:
Let's start with some examples:
The message(i18n) expressions should be referenced using the # character. So let's suppose you have the message.key in your translation file. To reference it in Thymeleaf you will have to use
th:text="#{message.key}"
In your scenario your key name is generated dynamically based on a variable so for preprocessing it in thymeleaf you need to use two underscores __
Let's suppose in your context you have a model variable called myModelVariable with a method messagePrefix(). Our example becomes:
th:text="#{__${myModelVariable.messagePrefix()}__}"
This means the myModelVariable.messagePrefix() will be processed first and the result will be used as the key name which will be then resolved to a nice user friendly message.
And if you also want to add a static part at the end of it will look like this:
th:text="#{__${myModelVariable.messagePrefix()}__}+'*'"
Even the key can contain a static part so this is also accepted:
th:text="#{__${myModelVariable.messagePrefix()}__.staticsuffix}+'*'"
More info you can find in the section 2.7 here:
https://www.thymeleaf.org/doc/articles/standarddialect5minutes.html

$$LAST_EXTRACT_DATE not in parameter file in informatica mapping - when run through DAC

I have created a new mapping in Informatica and I defined a mapping parameter $$LAST_EXTRACT_DATE (this is already defined in DAC(as it is working for out of box mappings)). However, When DAC is executing, this variable is not getting its values in parameter file of mapping. Other mappings are working fine. It's just this mapping which has an issue. I am trying to make this mapping to run in incremental.
Any suggestions please?
Yogesh,
I assumed that your mapping run with no issue and parameter $$LAST_EXTRACT_DATE are being replaced with a correct date through the DAC. You don't parameter file if you using DAC to run mapping. A parameter file is needed when you start the task from Informatica.
Make sure that the same file is used while running through DAC, as it's possible to run workflows in two ways:
just starting a workflow will make it read parameter file specified in the properties
starting workflow with indicated parameter file will make it read the given file INSTEAD OF the one specified in the properties.

Talend - load context to subjobs

I am trying to create a main job in Talend that would scan a directory for multiple files (f1.csv, f2.xls...)and then run a separate job created for the specific file. I would like to create a context variable that captures the filename and calls the appropriate job. How can I setup the context variable to store the filename of the found file and pass it to the other jobs?
Create a job called child_job. Inside, go to context tab, and create a new context variable called file with the type String. Inside, you can put components that references this context.file variable.
Now, create another job called main_job. Inside it, put a tFileList. Configure the settings in this component with the desired path where you want to find the files. Then, drag the child_job from the left panel (job designs) or put a tRunJob and set it to call the child_job job. Finally, join the tFileList with the iterate link with the child_job, select the child_job, go to Component tab, add a parameter (the file parameter that you created before) and set the value to ((String)globalMap.get("tFileList_1_CURRENT_FILE")) and you are done!
Something like that:

How to unimport a file from vbscript?

How do I unimport a file from vbscript? Because the file I imported has a lot of global variables, which coincides with the other file I want to import.
I just want to import 1 file at a time in order to prevent overlapping of global variables. How do I achieve that? Thanks.
All data made available to a current script context MUST be unique. If you use 'ExecuteGlobal statement' in the main context, routine or function then all data is available globally. Use 'Execute statement' to make data available in a current context.
http://msdn.microsoft.com/en-us/library/342311f1(VS.85).aspx

EnvDTE CodeClass.AddDelegate overload

I want to create 2 delegates with the same name but different parameters (overloaded delegate). When I try to add a delegate I get an error on the second try due to a delegate already existing. I tried to add it first with a temp name then add the parameters and then change the name so the signuature would be different but I still get an error stating that an item already exists with that name.
How can I add an overloaded delegate?
The capabilities of the code model to generate code are limited. You can try the to use EditPoint.Insert(...) to insert the code instead of using AddDelegate() method.

Resources