# How to use Field Calculator to assign values to only Odd (or Even) page fields for Data Driven Pages?

I am creating a map book but do not want the page numbers for each map page to be on the same side (since its printed double sided), I need the page numbers to be placed on opposite sides? I am using data driven pages. On a previous post it was mentioned to use ODD and EVEN pages per Map book with opposing numbered pages.

However I have over 200 pages. Is there a "creative" field calculator expression to use?

Or Should I just use adobe indesgn.

-
It'd be really helpful to see a screenshot of your attribute table. I assume you have a page number field that we could create an expression to grab the correct value. – ianbroad Apr 21 '14 at 1:29

The Field Calculator configuration below can be used to set values on any odd numbers in your Odd pages field (and blanks in the other rows).

In order to simulate a Data Driven Pages index for test data, I used Create Fishnet to create a polygon feature class in a file geodatabase, and then added text fields 4 characters in size called Odd and Even.

This index feature class has a numeric OID field and writes to an Odd field that is text. I will leave you to work out how to do the Even field. If you have a different numeric field specifying the page numbers (and order) just use that in place of OID.

The modulo (%) operator in Python, which is the crux of how to separate Odd from Even pages, is described here.

Parser: Python

Pre-logic Script Code:

``````def Reclass(oid):
if oid % 2 == 1:
return str(oid)
else:
return ""
``````

Odd =

``````Reclass(!OID!)
``````
-
what table has an OID that corresponds to the page number? That seems to be an unstated requirement for the solution to work. – Llaves Apr 21 '14 at 0:42
Where does the pre-logic code pasted? – slivingston49 Apr 21 '14 at 2:22
@Llaves Hopefully I have addressed your request for clarification in my revised Answer – PolyGeo Apr 21 '14 at 3:21
@user42720 I have added a graphic which should make this clearer – PolyGeo Apr 21 '14 at 3:22
PolyGeo: that did it. I'm aware that data-driven pages relies on a polygon layer to define the pages, I guess I'm not sure how in the case of something other than a regular grid the pages are ordered, presumably it's by the order of the OIDs, which let's your trick work, assuming they are consecutively numbered. – Llaves Apr 21 '14 at 17:56