cancel
Showing results for 
Search instead for 
Did you mean: 

Data Type Mismatch

Former Member
0 Kudos

I'm trying to create a formatted search, which includes the following snippet of code:

IF $[ORDR.CardCode] in (select cardcode from ocrd where groupcode = 256 and slpcode = 22) SELECT 'Text String'

When I trigger the FMS, I get the following error

Conversion Failed when converting the nvarchar value 'C12345' to data type int.

In this instance, CardCode translates to 'C12345'. I don't see why it is trying to convert the cardcode to data type int. I don't get an error when I run the code in SSMS (after replacing the field reference with the actual CardCode, of course).

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

The above snippet is just part of a larger FMS. Here is the entire code:

--Split Commission Rep
BEGIN
IF (SELECT MAX(T0.DiscPrcnt) 
		from RDR1 T0 
			inner join ORDR T1 on T1.DocEntry = T0.DocEntry
		where T1.DocNum = $[ORDR.DocNum])>=70
	SELECT 'Text 1'
ELSE
	IF $[ORDR.CardCode] in (select cardcode from ocrd where groupcode = 256 and slpcode = 22)
		SELECT 'Text 2'
ELSE SELECT '' END

The expected result is 'Text 1', 'Text 2' or blank. There error comes from the original code snippet.

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

What is your expected result from above FMS?

Regards,

Nagarajan