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

 


    • Related Articles

    • What macros can I use in an email?

      Macros within emails You can use macros within emails by putting a #!# around the macro. All the data field macros can be used as well. A full list of these is available at the link below: List of macros These can be used to display different values ...
    • How to include a conditional statement into a report using Macros

      The following guide explains how to include a conditional statement in a report using Macros This feature is available in the Lite, Professional, Premium and Managed subscriptions of One Stop Order Processing. Html templates contain many macros to ...
    • How to show custom order values in my Picking List or Sales Report?

      Introduced in version 2.0.0.32 You can now show the custom entered order values on the Picking List or Sales Report by using the following macros: [%CUSTOM_ENTERED1%] [%CUSTOM_ENTERED2%] [%CUSTOM_ENTERED3%] [%CUSTOM_ENTERED4%] [%CUSTOM_ENTERED5%] ...
    • How to automatically set custom values in orders as they are imported (e.g. for courier related values)

      If you are using a custom courier or require other default values in orders as they are imported (based on set values or other order values) use the following approach. This example shows how to set default values for APC courier Setup an advanced ...
    • "How to use ANDs and ORs when displaying values"

      There isn't a direct representation of AND or OR. However, this can be achieved in different ways. For example, To use an OR To see if a postage type is first class or expedited you can use the following #Expedited#first class#[?][%Shipping ...