Ask Your Question
0

Increase/decrease date per page

asked 2015-04-28 10:37:19 +0200

TheEarl gravatar image

updated 2015-04-28 10:37:51 +0200

Hello,

I got over 100 pages and all of them need date on top of the page. But the date needs to increase per page. For example:

Page 1: 1.1.2015

Page 2: 2.1.2015

Page 3: 3.1.2015 and so on.

Thanks for your help

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-09-23 11:20:31 +0200

ajlittoz gravatar image

updated 2020-09-23 16:09:58 +0200

This is not possible in the header because header contents is computed only once when the page style is activated.

Apparently, your pages are dedicated to events or matters happening on said date. It is likely there is a manual page break between pages to start content at top of page.

The idea is then to use a formula to increment a "date" variable.

On the first page, make a new paragraph and Insert>Field>More Fields, Variables tab with Type Set variable. Give it name pagedate (*), value your initial date and Format one of Additional formats fit for a date and your taste.

(*) CAUTION! Don't use "date" for the variable name; it appears somewhat reserved and will cause rejection of the formula.

On page 2, make a new paragraph and Insert>Field>More Fields, Variables tab with Type Insert Formula, Select your date variable and Formula pagedate = pagedate + 1, Format as above.

Create a specific custom-style for these paragraphs so that you can associate a "page break before" to them which will spare you the pain to insert it manually (and prevent the risk of forgetting it).

Copy the page 2 paragraph and paste it without modification at top of all your pages. Don't forget to remove your existing manual page break if any.

To show the community your question has been answered, click the ✓ next to the correct answer, and "upvote" by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

edit flag offensive delete link more

Comments

Any TextField of type Date or Time is internally based on a MasterField. You can define an offset for every DependentField independently. I would therefore suggest to insert a little TextFrame on the first (physical) page dedicated to contain a date field (and probably a page field), not inserted in a header (!!), but anchored to the page. The position and the format properties should be defined there,
You then can copy that frame and insert it on the next page and the one after... After each insertion only the DateField needs to be selected and edited using the context menu increasing the offset (in days) by 1 per page.
The process can be automated by user code. The internal (API) name of the offset property for dependent date/time fields is .Adjust there, and the mandatory unit is the minute (1440 per day).
See C:\fakepath\ask50002incrementedDateField_0.odt for an example.

Lupp gravatar imageLupp ( 2020-09-23 12:53:54 +0200 )edit

@ajlittoz, Tried it, but first field gives me "* Expression is faulty *". Maybe I am missing tomething.

LeroyG gravatar imageLeroyG ( 2020-09-23 15:31:57 +0200 )edit
1

@LeroyG: thanks for notifying. I made my experiment with a random variable name and used "date" in the answer without checking. It looks like "date" is somehow reserved. Changing for another name works.

ajlittoz gravatar imageajlittoz ( 2020-09-23 16:06:53 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-04-28 10:37:19 +0200

Seen: 59 times

Last updated: yesterday