jessica
jessica

Reputation: 1517

'msg' is undefined error Mirth

I am getting an error msg is not defined when trying to loop through different OBX segments. In my destination DB Writer I have the code
var msg = channelMap.get('msg');

but how to store the msg in the transformer with
channelMap.put('msg', msg)?

This is what I have currently in the transformer(javascript mapper):

var message = message.getRawData();

channelMap.put('msg', message);

In destination DB writer:

var msg = channelMap.get('msg');

Error:

TypeError: Cannot call method "getRawData" of undefined;

Upvotes: 1

Views: 2505

Answers (1)

Pablo Pazos
Pablo Pazos

Reputation: 3226

On the source connector filters and transformers, msg is a given variable, you can't (and should not) declare it (var msg) and is not on the channelMap to be able to get it (channelMap.get('msg')), you just use it: msg[...].

On the destination you can get the message without putting it on the channelMap.

Upvotes: -3

Related Questions