Map query result field values to variables.

Hi WM Gurus,

I have a simple flow service that query the db (return 4 fields). I mapped them to four variables. Then in the flow service, I loop the result set. I branch on fourth field if it is greater than zero, I will send an email. Send email is inside of sequence of inside of the branch. I was able to use the first three variable values in the email body but not the fourth one. The fourth one just gave me the expression.

So here is how my email looks like: ODI_Agent_Production_1, PRODUCTION, 13-NOV-2017 14:01:00, %/getMinuteGapOutput/results/MINUTEGAP%

Any help is really appreciated.

Franky

Hi Franky,

when a variable is empty (it does not have a value), it can not be resolved when using in an expression.
In this case the variable name will remain in the string as shown by you.

Regards,
Holger

Thank you, Holger. In my flow, I have a sequence label under the branch: %/getMinuteGapOutput/results/MINUTEGAP% > 0.

That condition works because it will send out correct emails. So I am confused as how does this expression works but the variables won’t work.

Attached is the execution results. As you will see, I have values for the fields in result sets: MINUTEGAP, and it is mapped to variable Gap. However, it is just not receiving that value. All other three variable works perfectly.

I also attached screenshot of my flow service.


2017-11-13_13-42-42.png

It seems to me that the variable “MINUTEGAP” is of type “Integer”, not “String”. Such variables are evaluated correctly when used in condition expressions but are not resolved when they are referenced as %…% in strings.

1 Like

Hi fml2,

Thank you for the explanation. How can I resolve it as string? Any tricks or workarounds?

I’d just set the output type for “MINUTEGAP” to “String” in the JDBC adapter service.

1 Like

Thank you, fml2! It worked.

In this case you might need to check your branch condition if it still works correctly.

You can have the result as Integer and then convert this variable to a string variable before using it in the email body.

If there is no built-in service (i.e. under pub.string folder) you can check for the WmTransformationServices package available from the download section from TechCommunity.

Regards,
Holger

Holger, you rated two posts of mine with four stars. Out of curiosity: why did you give four and not five? Were the replies not quite correct? Or off topic?

Update: Any news on this?