Hi All,
i am creating a BAQ with a calculated column to show carton number in a format “1/557 - 556/557 & 557/557 @ 6.0” (meaning total carton number 557, with the last carton number 557 with loose quantity of 6)
Below is my calculated column formula in BAQ, however, i get error messages on this column.
Error: Text: Arithmetic overflow error converting varchar to data type numeric.
(case when cast(SubQuery1.UD100A_NoofPcsPerCarton_c as varchar(15)) > 0.00
then (case when cast(SubQuery1.OrderDtl_IUM as varchar(10)) = 'GRS'
then (case when cast(Loose_Qty as varchar(15)) >= 1.00
then cast(('1/' + Tot_Carton + ' - ' + Tot_Carton - 1 + '/' + Tot_Carton + ' & ' + Tot_Carton + '/' + Tot_Carton + ' @ ' + Loose_Qty) as varchar(30))
else cast(('1/' + Tot_Carton + ' - ' + Tot_Carton + '/' + Tot_Carton) as varchar(30))
end)
else (case when cast(Loose_Qty as varchar(15)) >= 1.00
then cast(('1/' + Tot_Carton + ' - ' + Tot_Carton-1 + '/' + Tot_Carton + ' & ' + Tot_Carton + '/' + Tot_Carton + ' @ ' + Loose_Qty) as varchar(40))
else cast(('1/' + Tot_Carton + ' - ' + Tot_Carton + '/' + Tot_Carton) as varchar(30))
end)
end)
else 0
end)
Hi Hasokeric,
i try to remove all the casting on the comparison statement as what you suggest. but i still get the same error message. in fact initially the casting is not in the comparison statement. i put it in to see it resolved the error or not.
Below i amended the formula as below:
(case when SubQuery1.UD100A_NoofPcsPerCarton_c > 0.00
then (case when SubQuery1.OrderDtl_IUM = ‘GRS’
then (case when Loose_Qty >= 1.00
then cast((‘1/’ + Tot_Carton + ’ - ’ + Tot_Carton - 1 + ‘/’ + Tot_Carton + ’ & ’ + Tot_Carton + ‘/’ + Tot_Carton + ’ @ ’ + Loose_Qty) as varchar(30))
else cast((‘1/’ + Tot_Carton + ’ - ’ + Tot_Carton + ‘/’ + Tot_Carton) as varchar(30))
end)
else (case when Loose_Qty >= 1.00
then cast((‘1/’ + Tot_Carton + ’ - ’ + Tot_Carton-1 + ‘/’ + Tot_Carton + ’ & ’ + Tot_Carton + ‘/’ + Tot_Carton + ’ @ ’ + Loose_Qty) as varchar(40))
else cast((‘1/’ + Tot_Carton + ’ - ’ + Tot_Carton + ‘/’ + Tot_Carton) as varchar(30))
end)
end)
else 0
end)