Help & Support – Binary Numbers

Sage 200 Reporting  –  Help:

Help and Support

Binary Numbers

BINARY Choice. – Yes or No, True or False, On or Off.

There are just two options – Combining these two states can enable multiple combinations to be represented as a single number.

P8 P7 P6 P5 P4 P3 P2 P1 Base10
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1 255
0 1 0 1 0 1 1 0 86

The above demonstrates how numbers and their BASE representation can be used to record a set of binary states.

The set of EIGHT Yes or No options to identify the FORMs assigned to the new Customer Alerts text is being represented by a single number in Base10

Report # 168 – Sales Ledger Customer Alerts report uses the binary representation of the EIGHT possible FORMs that have or have not been selected against each alert test.

To convert the value held in the FORM variable back to its binary (Base2) equivalent we need to devise a set of calculations that can hold the fact that each of the eight columns is either a ‘1’ or ‘0’

The trick to break down the Base10 number into Base2 is to evaluate from left to right.

If the FORM number is >=128 then the first column must be ‘1’

(Setting all the other columns to 1 only adds up to 127)

We repeat a similar test for the other columns and obtain the ‘0’ or ‘1’setting for all columns.

Each test result will be held in its own variable and be recorded not as ‘0’ or ’1’ but as ‘0’ or ‘2n-1’ (where n = the column reference, working backwards).

Create a variable P8 with an if-then-else statement to check the value of the FORM variable.  P8 will then hold either 128 or 0

Variable P7 is a similar calculation where the FORM number is reduced by the value of P8 and then tested to see if it is >= 64

Use the See Nore>> options to expand the Examples.

EXAMPLE 1 – The calculation format

Show More >>

EXAMPLE 2 – Worked example when FORM = 255

Show More >>

EXAMPLE 3 – Worked example when FORM = 86

Show More >>