Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Prakhar1
Creator III
Creator III

tMap Expression always return false when passing a string expression using context variable

Hi All, 

I am trying to pass an expression in the tMap using context variable. like this

0683p000009M6L5.png

But when I am passing it in the t Map to evaluate its Boolean value its always giving false as an output, whereas if i pass the same expression directly  it is giving true for that.

0683p000009M6LF.png0683p000009M645.png

Labels (2)
1 Solution

Accepted Solutions
lennelei
Creator III
Creator III

It's never too late 0683p000009MA9p.png

 

One example:

 

tDBInput (read all columns) ==(row)==> tFlowToIterate ==(iterate)==> [ your process ]

 

This will run [ your process ] as many times as you have a row as input (100 times if you have 100 columns for example).

In [your process], you'll be able to use a globalMap variable from the tFlowToIterate to have the current column name.

 

You can see the documentation of the component here.

 

View solution in original post

8 Replies
lennelei
Creator III
Creator III

Hi,

 

first remark: context variables are linked to the job, not a component.

second remark: context variables are loaded at startup or with an tLoadContext component or explicitly assigned within the job (such as context.variable = value) (note that from my point of view, only the first use is recommanded).

 

That being said, what you are trying to do cannot work this way: values in the Context panel will not be evaluated as Java expression.

 

Could you please explain what exaclty you are trying to do?

 

Regards

Prakhar1
Creator III
Creator III
Author

I have a table containing the column names of the source table, and i want to take each column name and pass it in the expression. I will use java for this but i just tried it for one column but it's getting false output. 

lennelei
Creator III
Creator III

Let's forgot the context part: why does the first column defined in your tMap doesn't work?

 

In your job, you have:

  • two db queries entering your tMap: what are they for?
  • no join between both that is to say that by default, you'll have a cross join (cartesian product of both queries) : that may give you a lot of rows!

 

row1.designation will have the different values of the input row: it seems to be what you want, doesn't it?

 

 

Prakhar1
Creator III
Creator III
Author

1) The first column works perfectly, but what will i do when i need to pass 100 columns in the same expression.

2) I forgot to join the 2 tables, but after that the same result is showing.

If this is not a good idea, can you tell me how to pass 100 different columns in the expression field in the same expression.

lennelei
Creator III
Creator III

Can't you use a tFlowToIterate to loop over your columns?

Prakhar1
Creator III
Creator III
Author

i haven't used it before

lennelei
Creator III
Creator III

It's never too late 0683p000009MA9p.png

 

One example:

 

tDBInput (read all columns) ==(row)==> tFlowToIterate ==(iterate)==> [ your process ]

 

This will run [ your process ] as many times as you have a row as input (100 times if you have 100 columns for example).

In [your process], you'll be able to use a globalMap variable from the tFlowToIterate to have the current column name.

 

You can see the documentation of the component here.

 

Prakhar1
Creator III
Creator III
Author

Thankyou for the guidance 0683p000009MACn.png