on 12-15-2010 8:50 AM
Hello,
I've studied all the entries in the forum concerning automatic BP no. generation, but I am getting
the internal error 8180 with the follwoing script:
if $[ocrd.cardtype] ='S'
begin
select CAST ((MAX (CAST (T0.CardCode AS Numeric)) + 1 ) AS VARCHAR) from [dbo].[ocrd] T0 where T0.cardtype = 'S'
end
else
begin
select CAST ((MAX (CAST (T0.CardCode AS Numeric)) + 1 ) AS VARCHAR) from [dbo].[ocrd] T0 where T0.cardtype != 'S'
end
Our GP Code starts with 2701000000 for customer and leads and 2702000000 for suppliers. Related companies have external numbers like 0009000100 with leading zeros.
Can anyone help ?
Thanks in advance.
Michael
Hello,
finally I've asked a B1 consultant and got the followiong query as solution:
SELECT CAST((MAX(CAST(T0.CardCode as numeric)) + 1) AS varchar) FROM [dbo].[OCRD] T0 WHERE T0.CardType IN ((SELECT CASE WHEN $[OCRD.CardType] <> 'S' THEN 'C' ELSE 'S' END) UNION (SELECT CASE WHEN $[OCRD.CardType] <> 'S' THEN 'L' ELSE 'S' END)) AND T0.CardCode <> 'a'
Michael Benner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Only if you can guarantee all your BP codes are number, you can run this FMS.
You may check forum to find quite a few threads discussing it.
Better treat the lead identifier as letters.
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.