Skip to Content
avatar image
Former Member

FMS - Load Ship ORDR.Address2 ONLY if Customer is in Selected CustomerGroup

Hi,

I am trying to load a Ship address based using combined fields, ONLY if the customer isin a Select Group (in this case 106).

If not in the group I want the default shipping address to load.

My code is loading the new address OK but when the customer is not in group 106 the address is left BLANK. I want the original default ship address to load .

Could someome help on this point.

Version 8.8 Patch 11 SQL Server 2005.

Current Code

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

Declare @OrigAdd as Varchar (508)

Declare @Group as int

Declare @PCode as int

---Load copy of original address

Select @OrigAdd = $[$92.0.0]

Set @PCode = 106

select @Group = (select OCRD.GroupCode from OCRD where OCRD.CardCode = $[$4.0.0])

SELECT CASE

WHEN @PCode = @Group

THEN

(Select 'Customer: 'RTRIM($[$54.0.0])char(13)'Deliver To: 'RTRIM($[ORDR.U_ProjName])char(13)RTRIM($[ORDR.U_ProjAdd])char(13)'Contact: 'RTRIM($[ORDR.U_ProjConName])char(13)'Contact Ph. :'RTRIM($[ORDR.U_ProjConPh])CHAR(13)'Delivery Date: '+RTRIM($[$12.0.0]))

WHEN NOT(@PCode = @Group)

THEN (Select @OrigAdd)

END

++++++++++++++

Kind Regards,

Eric

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jun 24, 2010 at 10:31 AM

    Hi Eric,

    Just add to your CASE statement:

    WHEN @Group <> 106

    THEN ..... SELECT default ship-to-address......

    Regards

    Carin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Carin,

      Sorry,

      I put the Profiler on and the @OrigAdd was blank.

      I rechecked and found I had picked test customers with no ship Address.

      Your proding make me look harder, thank you.

      Kind Regards,

      Eric