How to search for different values using macros

How to search for different values using macros

You may want to have a macro (in a view, email or invoice) that tests for more than one value before generating an outcome.

For example, if you want to provide a specific courier for all postcodes except certain specified area codes.

This may be needed if you wanted to use UKMail as your shipping method for all postcodes except those the postcodes where you would use RoyalMail for example the islands such as Orkney(KW) and the highland areas of Scotland such as Inverness(IV).

You can exclude as many values as you want, in the example we just use two. You could include those for Belfast(BT), the Shetlands(ZE), Outer Hebrides (HS) and other highland areas such as Aviemore, Fort William, Oban and Mallaig(PH and PA). You could also include postcodes from the Isle of Man(IM), Guernsey(GY) and Jersey(JE).

In this example you are creating fields where the values are generated by macros.

 
To test for different values (e.g. KW and IV) you do the following:

1 Create a custom field (e.g Custom:Fixed val. 5) in the view that takes off the first two values of the delivery post code. Rename this view AreaCode. Use the macro below:

[%Delivery Postcode%][$][1][2]
You can include the first four values for the postcode by replacing the '2' for a '4' this will allow you to check for an area code plus the number after (e.g. IV14).

 

2 Create another field and use the macro below to test for the values postcode prefixes IV and KW. These are the area codes for the Inverness and the Orkney islands.  To test for these use the following code.

[#IV#KW#][?][%AreaCode%][RoyalMail][UKMail]


What this does is it looks for the area code value in the string #IV#KW# and if it finds it will show 'RoyalMail' and if not (else) it will show the value of 'UKMail'.

If you wanted to test by more than two values you just type the value and enter the # sign between each value. (e.g #IV#KW#BT#ZE#HS#PH#PA#)

For more information about how to include fields in your view see the link below:

Changing the fields shown in the main order list

For more information on how to update fields in the view see link below:

http://www.1stoporders.com/1StopOrdersDefFF.html