One Star

how to with tMap to define constants

Hello everbody,

I'm in front off a problem that I don't find how to solve to: I'm fetchning from an oracle database a field value. this value must be updated in an mysql database throw an update with two constants in a where row: UPDATE my_table SET my_field = oraclevalue WHERE field = 'firstField' AND secondField = 'secondField';
So my batch is based like the following one:

But from and to field are not variables but must be static values. How can I define their values ? Does I need to update the model? Does I need to update job to fetch the row matching from Mysql Database server and update it?
Best
14 REPLIES
One Star

Re: how to with tMap to define constants

Hi,

your image is not linked

you can use a look up (small file delimited) with and dooble inner join
or create global variables in a tJava / tSetGloblavariable and use filter the output
or create two context variable and use filteron the output.

some idea

Jeremie
One Star

Re: how to with tMap to define constants

If you are using external image provider you may block out people from helping you. Some companies have extreme restrictive firewall rules. I can not get your picture if you don?t attach them to your post.
If you need a constant value you can use a global variable. A global variable, you can set from any place in your job (like with tPrejob) and then use in your tMap. I?m usually using a context Variable for global Variables because I like the CTRL+Space functionality.
One Star

Re: how to with tMap to define constants

please accept my apologises for picture, I have post a bad link url.
One Star

Re: how to with tMap to define constants

Hello,
thanks for your feedback.
So I have add a t_SetGlobalVar with two variables: Var1 with value firstField, Var2 with value secondField.
But I'm sorry but can't found how to use them in t_Map?
Smiley Frustrated
Best regards
One Star

Re: how to with tMap to define constants

You can use with ctrl+space in the expression builder (clic on the ...)

jeremie
One Star

Re: how to with tMap to define constants

hello,
thanks for yours feedback.
So I have used them like this, but I'm not sure that syntax is wrong because CTRL+space doesn't give me my variables in list.
The job contains now a t_SetGlobalVar which have two variables definitions.

In My Map, I have update the variables with CTRL+Space

But when I run job, I have an error that mapping fields cannot be null.
So, My mapping is wrong, I suppose that my variables declarations is wrong, but I can't see why.
Does someone can help a newbie? Smiley Happy
Best regards
One Star

Re: how to with tMap to define constants

I don't no, I think it's the schema of your data
Perhaps put an onsubjobOk after the tSetGlobalVariables

Jeremie
One Star

Re: how to with tMap to define constants

As I said, if you don?t attach the picture to the post, I will not be able see them. If variables are not available, then you did not declare them before.
One Star

Re: how to with tMap to define constants

Well,
I have put a subjobok on the variable declaration, but variables are always unavailable in the tMap.
Here's a screenshot.
One Star

Re: how to with tMap to define constants

When I was talking about the CTRL+Space I?m talking about variables declared in the Contexts (second tab, between Job and Component). Did you declare your variables there?
Using context variables is only one way to deal with the situation but it is the way with the CTRL+Space.
One Star

Re: how to with tMap to define constants

Hello,
well I've tried this way too. I have defined in a conversion 1.0 context variable in left menu two variables, FROM and TO. But in this case too, I can"t see them in ctrl+space context.

Perhaps could you post me a screenshot on the way to define theses variables, I'm sure I'm passed next something ...
Best regards,
One Star

Re: how to with tMap to define constants

.
One Star

Re: how to with tMap to define constants

really thanks you for your help
just one last question: what is the difference between global variables defined in t_globalvar, context, and these kind of variables?
One Star

Re: how to with tMap to define constants

Hi,

in t_globalvar you define global variable for the job
in context you can create differente situation (prod,dev) with different value for the context variable. When you generate scriptjob you can choose the context (and the values of the context variable) to execute the job on the server.
After you can use "implicite tConextLoad" in the wiev job>extra : we load values of context variable from a files or data base (key;value)
For me, It's the unique interacrtion between user and job script on the server.

best regards

jeremie