Set a parameter in a parameter file and use it in a same workflow - informatica-powercenter

I have a requirement to set a parameter say a timestamp in a parameter file using a command task that triggers a Unix shell script that does this task in a workflow and later in the same workflow, use the parameter that is set earlier. Is that possible?
The informatica version used is 9.6

You need to define the Parameter file property on a Session. Not just set the parameter value for a session, but make the session read the paramfile.
With Workflow parmeter file it works like this (briefly speaking):
Workflow is initialized and reads the assigned parameter file. All variables are set.
Upon session initialization all the variables and parameters are already set .
The file is not read again, variables are not re-set.
However, once a parameter file is defined as Session property, it works in a bit different way.
Workflow is initialized and reads the assigned parameter file. All variables are set.
Session is initialized, and it reads its own parameter file, setting all variables and parameters.
In this case, the values defined in session parameter file will be used.
Of course, it is not necessary to use Workflow level parameter file.
It is also possible to have one session that generates the parameter file for the very next session to use it. Provided it is defined as session property, as mentioned above.

I got the solution :). Dont know if there is any other option. But the trick that worked for me is, if you have to set a parameter and then read back the parameter to use it in the same workflow sue to whatever requirement, then you can set the parameter and then use it in a session inside a worklet, and this perfectly works. I am not sure why but this definitely works :)

You can use the Assignment task for this purpose. Set a workflow variable and use it wherever you want in the same workflow.

Related

How to use a variable value from mapping for taking a decision to send an email or not

I'm working on a requirement where i have to call a Stored Procedure from Informatica Mapping and store the returned value in a variable and pass that variable value to workflow level and then se it in taking decision for sending email or not.
I have created the mapping but not sure how to pass the variable value into the email task.
Any suggestions on this?
Thanks
Use Mapping Variable and set it with SetVariable function. Next, create a Workflow variable and use it on your session Components tab, in Post-session on success variable assignment to pass the value from your mapping variable, to your workflow variable. Then use the workflow variable in your email task - or anywhere else in the workflow.
It's a very good idea to initialize your variable with some default value, like -999 for example, using Assignment task in the workflow and then also use the Pre-session variable assignment to pass the default value to the mapping variable. Otherwise you may be processing with the value persisted in the repository.

what container we can use for global and environment variables in Jmeter for API testing

I am trying to use Jmeter for API automation testing.
But Jmeter hasn't provided any separate containers for global and environment variables similarly like SOAP-UI and Postman.
I tried to use property file which also shared among all the JSR223 throughout the project but property having many others keys too and I haven't got any option by which I can delete key which been initiated once. Moreover, I can update the value too which seems most preferable to use
Below code I am using to set and get the values
props.put("shubhamKey", "shubhamValue")
props.get("shubhamKey")
I can also update it using same key
props.put("shubhamKey", "shubhamNewValue")
But as I said we can't delete key once initiated and it seems dangerous to delete from properties as it has many other keys too which may be required by Jmeter internally
After seeing too many things I have seen "User Defined Variables" where I can specify my key-value pairs. I am able to get the value using below code:
vars.get("shubhamLocalVariable")
But I am not able to set the value using below code:
vars.put("shubhamUserKeyagain","shubhamUservalue")
neither I got any option by which I further update it or delete it.
so Is there any feasible thing to store variables in Jmeter which can be easily created/deleted/updated using the code and can even call by other containers like HTTP Request.
Moreover I also want a container which preserve the values so the next iteration and next time (any time like other day) it will start with latest values
User Parameters
Jsr223
Any workaround will be helpful and appreciated in advance
As for me, I'm using a JSR223 Sampler at the begining of every Thread.
And for me it works:
vars.put("checksums_1","")
vars.put("checksums_2","")
vars.put("checksums_3","")
Firstly you can delete properties by using:
props.remove("shubhamKey");
And if you use specific prefix/suffix it shouldn't effect JMeter internally.
User Defined Variables isn't the best way to handle dynamic values, it's used for static variables
Note that all the UDV elements in a test plan - no matter where they are - are processed at the start.
But you can set variable by string or variable or function, e.g:
For defining variables during a test run, see User Parameters which use similar assignments.

how to pass parameter in custom command in Gocd tool?

I am trying to use go cd for continuous delivery and create a pipeline for the same. I m able to get success result after running the job but in that job i did not pass any parameter.I want to pass parameter in custom command to reduce repetition within my configurations.
We can pass parameter via a environment variable -eg If you want to pass a version in your custom command and value is 1.2.4 so define the value in environment variable and pass the value in your command for example ./abc #{version}.
You might get error while editing the command (Parameter is not defined error) add the same varibale in parameter tab as well .[![enter image description here][2]][2]
I could not get the clear picture of what you are expecting. But as far as I could understand, you want to perform a custom command task by passing few parameters as input.
When you choose custom command, you will get something like
In Arguments block, you could give the input parameters you need to pass for that particular task.
Edit : I think this may help you.
Parameterize your Configuration
Please go through this link and see whether this helps you. They had explained about defining and using the parameter in a pipeline

Changing data source connection at runtime in an Informatica workflow

I have a mapping which I need to be able to run against multiple source schemas (having the same structure), one schema at-a-time. Given the number of schemas, I would rather not set up a session for each schema in order to specify a particular mapping connection, as that will require new sessions to be added as new schemas are added.
Is it possible to set up a workflow in such a way that the data source connection for a mapping within a session is defined (or passed in as a parameter of some sort) at run-time?
Configure the workflow or the session to use a parameter file.
In the session settings, change the 'hard-coded' source connection (option Use object) to Use Connection Variable and enter a variable name with a $DBConnection prefix (e.g. $DBConnectionSource01).
Create a parameter file in an appropriate location with the following contents:
[Global]
$DBConnectionSource01=connection_name
I believe what you are looking for is going to be solved using a parameter file and a bit of shell script (assuming your server is on some Unix flavour).
Setup your workflow to run with a parameter file. Declare a special parameter for Database Connection (staring with $DBConnection) in the parameter file global section. Change your session properties to use that parameter.
You need to create appropriate Relational connection objects for each of the source db/schemas.
Now, write some shell program to dynamically change that parameter file and replace the value of the parameter in parameter file with the new value you want.
Typical sequence of events at run time should look like this -
Whenever you want to run that workflow/session/mapping for a different source, launch the script with appropriate parameter to effect the change in Informatica parameter file.
Shell script runs for launching the job for a given db source. The script run should change the $DBConnection parameter in parameter file
Launch the workflow through pmcmd using the parameter file.

Using parameters as user Defined Variables?

We run our tests in non gui mode and pass in various parameters like Server, port, threads etc. We'd also like to run our test in GUI mode, and be able to change these parameters in the GUI.
What I wanted to do, was use 2x User Defined variable objects, and have one with static data we can edit, and another with parameters. That way the actual test plan doesn't change, but we can set variables as parameters, and just disable the static data one. Or disable the parameterized one when we want to run with static data.
But this doesn't seem to work - no errors nothing.
I do something similar, but I used a UDF for this.
What I did was set up my variables and use default values.
VARNAME VALUE
otl_PROTOCOL ${__P(otl_protocol,https)}
otl_PORT ${__P(otl_port,443)}
otl_THREADS ${__P(otl_threads,1)}
otl_REPS ${__P(otl_reps,1)}
otl_RAMP ${__P(otl_ramp,0)}
I did one for server name as well. This way, I can use the defaults here or I can pass in parameters in either the command line args or in my user.properties. This works very well for me.
How are you passing in values from non-GUI mode? via CSV, using properties, User-Parameters, etc.?
If CSV, this is an easy fix. Simply create a User Defined Variables (UDV) object at the Test Plan Level and "hard code" all your parameters (Server, port, etc.). Keep your CSV config. If you run in GUI mode, disable the CSV and enable the UDV. When you save the file, keep the CSV enabled and the UDV disabled - that way when you run from non-GUI it'll read the CSV file.
If using properties, I would do the following: Create a UDV with all your parameters (Server, etc.). Before entering values, copy the component so you have TWO identical UDVs. In UDV 1, enter the property value from the command line. In UDV 2, enter the "hard coded" values. Throughout your script, replace any references to the properties with variable references. It would look something like this:
UD1: UD2:
Name Value Name Value
SERVER ${__P(Server)} SERVER devdomain.com
PORT ${__P(Port)} PORT 4111
Some HTTP Request
Domain: ${SERVER}
If using user-parameters, it would be the same concept as above.
Actually i am using a function named as regular expression for getting value.
here i have to use variable under variable because there is lots of value with same boundary, so i have selected one paragraph as ${ABC} and fetching value from this paragraph ${XYLEM}. both the variable created as regular expression.tried with ${__V(ABC${XYLEM})};
${__setProperty{Search_Investment_Banking,$Investment_Banking}};

Resources