Using a Parameter in Expression Transformation - informatica

I have a workflow in which I've set up an expression transformation to select $$Param for a particular field, and then within the target properties I've set a delete value. I've tried this by substituting $$Param for a hardcoded value and it works fine, however, for some reason when I put in $$Param, it doesn't actually do the delete. Is there a reason? Am I doing something wrong?
Just for clarification, the workflow executes successfully - no error is thrown but it's not doing what it's supposed to.
Thanks in advance,

$$Param needs to be passed thru a parameter file and you have the option to set an initial value when you declare the parameter in the mapping under Mappings > Parameter and Variables.
Have you looked at the session log to see what's the override value of $$Param is being used? If it's a SQL delete, try to turn see in the session log the query being executed in the database.

Related

Including parameter expression

I'm new in Informatica PowerCenter, trying to use a new declared parameter expression in Workflow Session parameter file.
Objective: the expression is being feed automatically from data base, so the reason behind all this is to be able to change the logic in db, parameter file will re-generate in the next run with the new logic which ultimately will cause not to change nothing in power Center, only record expression in db. Off course for new fields you will need to change informatica.
Let me summarize or try to be deatailed as posible.
Parameter file has no issues, when executing the workflow it's being read with out issues, here's an example of the parameter expression I'm trying to use (rest of them, dbCon, time etc i delete them)
[Example.WF:Example.WT:.ST:Example]
$$Param_checker=IIF(1=1,'A','B')
Mapping
Created the parameter in the mapping as:
Name: $$Param_checker
Type: Parameter
Data Type: String (as per doc)
Precision: 10000 <-- making sure there's no cut
IsExprVar: true
Created a field in a Transformation Expression Box (the violet one) as:
Name: out_param_checker
Data Type: String
Precision: 10
O: X
Expresion: $$Param_checker
Workflow
In it session reads correctly the parameter file of the Mapping replaces all variables but when it comes to $$Param_checker it's not being expanded, this is a sample of log outcome when inserting on data base (cast and allfunctions are done by Inf. aut.:
CASE WHEN CAST('$$Param_checker' AS VARCHAR(4000))
And off course in Data base when process finishes I see the string as well '$$Param_checker'
Just in case, and sorry for being verbose, I do already have a parameter with a expression working but in a source Qualifier using it on a SQL statement.
The issue is why can't I use it in a out field. Forgot to mention that we have redshift under the hood, all sessions are set to "Full" Optimization, hence I think that's the issue.
If anyone have any hint would appreciate it.
Thanks

Dynamic where clause using page item in interactive report does not work

I simply created a interactive report based on the oracle table and set a Hidden Page Item called P1_contrain_parameter to receive the value passed from another page. The P1_contrain_parameter is used in the where clause as follow:
(Column_name = :P1_contrain_parameter)
But it does not work in this way. I tried to set the page item as Display only and found that the value has been successfully passed to the current report. I also tried to set the where clause as
(Column_name = 'actual_value')
It also works. However, it just do not what when I pass the actual value to P1_contrain_parameter to construct the dynamic where clause. Can anybody tell what might be wrong here?

Using mapping variables in a post-session command

Workflow generates three files (header, detail, trailer) which I combine via post-session command. There are two variables which are set in my mapping, which I want to use in the post-session command like so:
cat header1.out detail1.out trailer1.out > OUTPUT_$(date +%Y%m%d)_$$VAR1_$$VAR2.dat
But this doesn't work and the values are empty, so I get OUTPUT_20151117__.dat.
I've tried creating workflow variables and assigning them via pre-session variable assignment, but this doesn't work either.
What am I missing? Or was this never going to work?
Can you see the values assigned to those variables on the session log or do they appear empty as well?
Creating workflow variables is what I'd try, but you need to assign the values with the post-session variable assignment.
Basically, you store values in a variable in your mapping and pass the values up to the workflow after the session succeeded. Here is how you can achieve that:
Define a Workflow variables $$VAR1 and $$VAR2
Define the variables in your mapping, but chose different names! So i.e. $$M_VAR1 and $$M_VAR2
In your mapping, assign the values to your mapping variables through the functions SetVariable(var as char, value as data type)
In your session, select Post-session on success variable assignment.
In step 4, the current value from $$M_VAR1 (mapping variable) is stored in your workflow variable $$VAR1 and can then be used in the workflow in command tasks like you asked.
A few notes:
I'm not 100% sure if the variable assignment is exectured before the post-session command. If the command is executed first, you could execute your command tasks in an external command task after your session.
Pre-Session variable assignment is used if you pass a value from a workflow variable down to a mapping variable. You can use this if your variables $$VAR1 or $$VAR2 are used inside another mapping and need to be initialized at the beginning.

BIRT - using multiple webservices to get the data

I am trying to generate a report using Eclipse BIRT report designer.
The scenario is this:
There are 2 web service data sources. There are 2 datasets for webservices 'WS1' and 'WS2' respectively.
The output element 'COUNTRYID' of one webservice 'WS1' would go as input for another webservice 'WS2'.
What I did:
Created a parameter COUNTRYID.
Created a dummy Computed Column in the dataset of the web service 'WS1' with the expression:
params["COUNTRYID"].value=row["COUNTRYID"]
Now the input parameters for the 'WS2' dataset is related to the global paramter 'COUNTRYID'.
When I run the report, I see that the global parameter contains the value from the 'WS1' output.
But the report does not display the values from the response of the web service 'WS2'
My questions:
How can I see, if the webservice got fired or not?
How can I see, if the webservice got fired with correct values ?
WS1 is not fired unless it is explicitely bound to a report element. Typically, to achieve this we apply following steps:
insert a data element at the beginning of the report body
turn the property visibility of this new element to false (or let it visible during testing)
bind it to the first dataset WS1
It will force a silent execution of WS1, and therefore this will populate your parameter COUNTRYID before WS2 runs.
However this approach would not work if:
WS2 dataset has to be used to populate selection items of a report parameter (which does not seem to be the case here)
If COUNTRYID parameter is used at render time. This point is much more annoying, if you need this parameter in chart expressions for example. If so, i would recommend to store WS1 in a report variable instead of (or why not in addition to) a report parameter. See this topic to see how to create a report variable.
You can initialize it at the same place you did for the report parameter with:
vars["COUNTRYID"]=row["COUNTRYID"];
and use it anywhere with
vars["COUNTRYID"];
Report variables are available from the palette of expressions editor :

Cannnot Assign- must be a instance Django

I have a table called job_position and there is a foreign key called region.
position =job_position.objects.get(id=position_id)
position.department= department.objects.get(department_name =request.POST.get("department")),
the "department" is passed from the HTML form, and the value of it is "Asia"
I am quite sure the error is from the second line
Cannot assign "(<region: Asia>,)": "job_position.region" must be a "region" instance.
But when I am trying the code in python shell ,it works fine,ie.e can get the region object and pass it to the position object region attribute and works fine. But somehow it does not works in the web development.
Anyone can help explain? Thanks very much
Cannot assign "(<region: Asia>,)"
As you have a comma at the end of your line, it turned it object into a tuple. Simply remove the comma:
position.department = department.objects.get(department_name=request.POST.get("department"))