I am building a simple workflow using Node-Red and Ms-SQL. The MS-SQL Node receives an dictionary object with multiple key-value. MS-SQL node is executing in query mode, and returns value from database. My requirement is - to append the value that is received from query to the incoming Payload.msg. I have modified my query to attain this -
Select '{{{payload.ProductType}}}' As PolicyType,
'{{{payload.RuleType}}}' As RuleType,
'{{{payload.SystemAssignId}}}' As SystemAssignId,
'{{{payload.TransTypeCd}}}' As TransType,
'{{{payload.TransEffDt}}}' As TransEffDt,
'{{{payload.AddlRetPremAmt}}}' As AddlPrem,
'{{{payload.TermPremAmt}}}' As TermPrem,
'{{{payload.PolicyExpDt}}}' As PolicyExp,
'{{{payload.PolicyEffDt}}}' As PolicyEff,
a.PolicyLossInd,b.LossDt, b.LossPaidAmt From [MyTableA] (nolock) a
left outer join MyTableB] b on b.SystemAssignId = a.SystemAssignId and b.TransSeqNo = a.TransSeqNo
Where a.SystemAssignId = '{{{payload.SystemAssignId}}}' and a.TransSeqNo = 1
This works well, however there is a slight problem. If the incoming message payload key:value changes, I need to update the query as well, which is bad. Hence I believe there might be a better way of handling this issue. Any suggestions/pointer