cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Eric,

Just add to your CASE statement:

WHEN @Group <> 106

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

Regards

Carin

Former Member
0 Kudos

Carin,

Thank you for the response.

When the group = 106 the new address is loading OK.

My problem is when the Group ISNOT = 106. I want the ship address normally loaded by the system.

In fact I'm not sure if the FMS triggers before the system first load the default address, if it does, I will need a new approach. That is I may need to load the standard address using the same script the system uses.

Any ideas.

Kind Regards,

Eric

Former Member
0 Kudos

Hi Eric,

That's why you need to add another condition to include the default ship-to address.

In the current code you say: Do nothing when <> 106 and that's why there is nothing.

Hope it helps.

Regards.

Former Member
0 Kudos

Carin,

Thanks again.

The current code has this

"WHEN NOT(@PCode = @Group)

THEN (Select @OrigAdd)

END

"

However I am starting to think the @OrigAdd may be empty and never picks up the address at start of FMS.

I am setting up test enviroment to check.

Kind Regards,

Eric

Former Member
0 Kudos

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