2 Replies Latest reply on Apr 9, 2015 2:06 AM by zinny

# working out if a record number is odd or even

### Title

working out if a record number is odd or even

### Post

Hi guys,

I am creating a report where I have to place records in two columns. I am taking records from three different tables representing different types of records, getting the info I need as one field and putting it into a new table.

each record is then given a position in the final report - a row and a column (a or b) so that each record is either r1:c1 or r1:c2, r2:c1 or r2:c2 and down the line. this number combination is given to them sequencially. So there are twice as many records as rows.

Each record then links to a display table where a record has two portals and nothing else - one links to the row based on the display record number and the column based on a fixed C1 or C2.

this is all working fine but I have a wrinkle that I need a calcualtion solution for.

The report sorts the records by type but there could be an uneven number of records for each type. If there is an uneven number then the next record (from a different type) ends up the last record in the previous subset sort and everything goes out of whack.

I want to be able to calculate if a sub set of records has an uneven number and create a extra dummy record so that my rows sort correctly.

Anyone got a great simple calculation that can get me a boleen that a record number is uneven (or even) so I can create the extra record?

I am working in FM11

Thanks

• ###### 1. Re: working out if a record number is odd or even

Hi Reuben,

You could use the "Mod" function that returns the remainder after a number is divided by devisor.

The following calculation will return 1 for an uneven \$\$value and 0 for an even \$\$value...

Mod ( \$\$value ; 2 )

...

You can replace \$\$value with any number you like to use this calculation on. The following will for example will return 1 for an uneven record number and 0 for an even record number...

Mod ( Get ( RecordNumber ) ; 2 )

Hope this helped,

TS_Bamse

• ###### 2. Re: working out if a record number is odd or even

Thanks, that's perfect. so many functions to learn