Jump to content
sdutton

Insert last year's date (just the year) in a sentence

Recommended Posts

Every January, I send out a note referring to the previous year.  Is there a way to have the previous year inserted automatically in the sentence?

 

ex. "Total number of hours served in 2017 . . ."  

 

Share this post


Link to post
Share on other sites

Why not create a field for the year, it could be just a number or use the year function.

 Year (yourDate::Date ) and then merge either of those Fields.

Share this post


Link to post
Share on other sites

Thanks for the quick reply.  Sorry, I'm not quite getting what I should do.  I'm able to insert just the current year into my sentence using {{CurrentDate}} , formatting out the month and day.

So my sentence now says . . . Total number of hours served in 2018:

I need the sentence to say . . . Total number of hours served in 2017:

Is there some way to impose a calculation on the {{CurrentDate}} ?   Something like {{CurrentDate}} - 1

Share this post


Link to post
Share on other sites

Date ( Month ( Get( CurrentDate )  ) ; Day ( Get(CurrentDate ) ) ; Year (Get(currentdate ) ) - 1 )

Share this post


Link to post
Share on other sites

I'm so sorry.  I'm obviously missing something.  Maybe I need to explain myself better.

In my annual letter that I send out each January (it's in Layouts), there's a phrase in one of my sentences that says (this is in the Layout Mode), "Total number of hours served in {{CurrentDate}}:

When I go into the Browse mode, that phrase becomes, "Total number of hours served in 2018:"  I need to have a phrase that says, "Total number of hours served in 2017:"  So in the Layout Mode, what does that sentence need to look like?  When I tried the formula you typed above, it wasn't generating anything when I went back into the Browse Mode.  Also, you have listed Month and Day . . . I only need the year.

Thanks.

Share this post


Link to post
Share on other sites

Hi sdutton,

I understand what you are asking, and I think this is more of how to implement it.

Why not post a copy of your file or a mock up of it, so we can see your schema?

Lee

 

Share this post


Link to post
Share on other sites

Is your text in a text object? I.e., it's not in a field, it's directly on the layout? You can't perform calculations directly in text objects.

In order to use the calculation you want -- Year(Get (CurrentDate))-1 -- you'll need to create a calculated field (or a field where you set the calculation using auto-entry or a script, or use a script to set a global variable). Make sure the storage of the calculated field is set to unstored so it will always update.

You can then use Insert > Merge Field (or Merge Variable) to insert the field or variable into your text.

Share this post


Link to post
Share on other sites

Sorry Tom,

We fix the need by using a number field and merge field.

Lee

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×

Important Information

By using this site, you agree to our Terms of Use.