DBQuery with like referencing source field

Situation:

A DBQuery works in my map when I use like with a constant:
and Detail like '%Test, Randall (Employee) coverage added%'

But not when I replace the constant with a source field - either a variable or the field itself:

and Detail like '%$vMemberName ($vMemberType) coverage added%'
and Detail like '%$Input_AdvDBSchema/DB/employees/MemberName ($Input_AdvDBSchema/DB/employees/MemberType) coverage added%'

I tried putting quotes around the fields, but got an error - so I know that it seems to pull the detail, but it's not returning valid results when I remove the quotes.

Error while executing query:select distinct SocialSecurityNo from bc_addchangeterm where CompanyName = ''Adeptia'' and SocialSecurityNo = ''111111111'' and Detail like ''%''Test, Randall'' (''Employee'') coverage added%'' and CreationDate > dateadd(mi,-65,getdate())::Incorrect syntax near ''Test''.]

Any ideas?

 

Tip:

It looks like the variable isn't evaluating when it is inside the '% characters. Try creating the entire "like" value in a variable.

Ex: varLike = concat ($apos , '%' , $vMemberName, '(', $vMemberType, ')' , 'coverage added%' , $apos)

Then the DBQuery will be

and Detail like $varLike

Have more questions? Submit a request

0 Comments

Article is closed for comments.