Page 1 of 2

Year Variable

Posted: Tue Sep 16, 2008 8:40 am
by lacastle
Is it possible to create a new variable that is just the current year? Can't seem to find where MadCap sets the System Variable code.

Thanks.

Re: Year Variable

Posted: Tue Sep 16, 2008 10:38 am
by Andrew
Sure -- just create a new variable, call it currentYear (or whatever), and enter the year. You will, of course, have to change it manually every year.

Re: Year Variable

Posted: Tue Sep 16, 2008 10:51 am
by lacastle
Yeah, I knew I could do it that way. :( I might as well just type the year and not use a variable if I'm going to have to manually update it. I just want it on the copyright page.
Thanks.

Re: Year Variable

Posted: Tue Sep 16, 2008 10:57 am
by Andrew
I figured that might be the case. I poked around the Flare program files trying to find out if there was any nifty little XML or other code we could hack up, but I came up empty. Looks like system variables are hard-coded into the Flare app.

Re: Year Variable

Posted: Tue Sep 16, 2008 11:09 am
by lacastle
Thanks for trying. I couldn't find anything either. I guess I'll submit an enhancement request for customizing/creating new system variables.

Re: Year Variable

Posted: Tue Sep 16, 2008 11:38 am
by RamonS
The question is also which year you want. The year the output was compiled in or the year the topic is viewed. Also, unless the content gets drastically changed I wonder if there is a need to adjust the copyright year.

Re: Year Variable

Posted: Tue Sep 16, 2008 11:45 am
by lacastle
Yeah, I guess it's not that big of a deal. I just wanted to have the ability to make custom, auto-changing variables, so that's what I asked for in the enhancement.

Re: Year Variable

Posted: Tue Sep 16, 2008 12:30 pm
by LTinker68
Are you having the copyright info appear on every page? If so, then maybe adding it to a masterpage would be easier. Wouldn't even have to be a variable -- just enter the date on the masterpage and it'll appear on every topic.

Re: Year Variable

Posted: Tue Sep 16, 2008 12:35 pm
by lacastle
No, I was trying to create a print target for my help that had a copyright page. It would have taken me 1 second to type 2008, but instead it's been a lot longer thinking about the possibilities! I never seem to like the easy way if i think there may be an easier! :)

Re: Year Variable

Posted: Thu Feb 05, 2009 4:51 pm
by nfberg
Digging this back up from the past...

Is it yet possible to accomplish?

Re: Year Variable

Posted: Fri Feb 06, 2009 5:18 am
by RamonS
Is what possible to accomplish? This thread tossed several ideas around and I don't know which one you mean.

Re: Year Variable

Posted: Fri Feb 06, 2009 7:44 am
by nfberg
Sorry...

I should know better to be clearer in my questions...

We don't want to have to revisit the docs we provide to our clients every year to update the copyright info on the Master and would like to place a bit of code that would update annually.

All of our products are vBulletin plugins and we are able to insert a bit of code in the branding of the actual product that reads "Copyright 2008 - currentyear OurCompanyName" that automagiclly updates. We'd like to extend this into the doc set as well.

Re: Year Variable

Posted: Fri Feb 06, 2009 8:04 am
by Andrew
I don't believe anything in Flare has changed regarding this.

However, as an idea for how to handle this, could you create the copyright stuff as a snippet, and then, using Global Project Linking, make the change every year to one snippet and have it update the text across all of your projects?

Re: Year Variable

Posted: Fri Feb 06, 2009 8:08 am
by RamonS
The copyright year only changes when there are substantial changes to content. Unless that is the case each year you don't need to change the year each time when a handful of topics were added. There are fairly specific rules as to when the year is to be changed. I think I have them somewhere in my endless dungeon of digital documents. I may find it and if I do I share it here.

Besides that, I'd go with the masterpage way or the solution that Andrew proposed.

Re: Year Variable

Posted: Wed Jun 16, 2010 11:04 am
by cbdebris
The issue is that many of us want a variable for <year> that applies to whatever we define. And there's no easy way to get one.

For example, in FrameMaker our <year> variable updates to the system year of the last save.

It doesnt matter what the copyright rules are -- what matters is what the boss wants and expects.

Re: Year Variable

Posted: Mon Jun 21, 2010 12:56 pm
by peterbrown05
I would like a variable similar to <year> but one that is the 'build' date. Our automated build system will compile the help weekly and it would be nice for it to automatically include the date in the document. Currently we have a custom build step that creates a custom variable file for each weekly build. All automated, but not very efficient/neat.

Re: Year Variable

Posted: Tue Jun 22, 2010 5:57 am
by Andrew
peterbrown05 wrote:I would like a variable similar to <year> but one that is the 'build' date. Our automated build system will compile the help weekly and it would be nice for it to automatically include the date in the document. Currently we have a custom build step that creates a custom variable file for each weekly build. All automated, but not very efficient/neat.
Have you looked at the "System" variable set? It contains things like ShortDate, which is the current date (while building the target). That seems like exactly what you want.

Re: Year Variable

Posted: Thu Dec 08, 2011 2:45 am
by NetDisplaySystems
Sorry to bump this topic, but if anyone is still interested in the initial problem (getting the current year automatically in your content), I've solved it by inserting a little script (javascript).
This did the trick for me:

Code: Select all

document.write((new Date()).getFullYear());

Re: Year Variable

Posted: Thu Dec 08, 2011 7:21 am
by crdmerge
Thanks for that!

Re: Year Variable

Posted: Fri Dec 09, 2011 8:34 am
by jasonsmith
In the System variables set there are variables LongDate and ShortDate that contain the current year so I guess it shouldn't be that difficult to implement.

Re: Year Variable

Posted: Fri Dec 09, 2011 10:48 am
by RamonS
But that inserts the year of the date the output was generated, which seems is not what is wanted here.

Re: Year Variable

Posted: Fri Dec 09, 2011 11:45 am
by crdmerge
peterbrown05 on Mon Jun 21, 2010 2:56 pm said:

"I would like a variable similar to <year> but one that is the 'build' date."


Yes?

Re: Year Variable

Posted: Fri Dec 09, 2011 12:18 pm
by peterbrown05
there are several solutions to similar problems here, some of which are solved previously and some more recently solved with javascript.

I used the Date variable on the front cover, ie Document Date: 23rd July 2011
but at the bottom of every webhelp page I also wanted the copyright that says "Our Company 2000-CurrYear"
the javascript trick should work for that (but havent had time to try it yet)

thanks all

p

Re: Year Variable

Posted: Wed Jul 24, 2013 7:54 am
by RobinS
A newcomer writes: is this still not possible 'out of the box' without resorting to javascript? Like a previous poster, I just want it to pick up the year of the build date. Seems a bit basic...

Re: Year Variable

Posted: Mon Jun 29, 2015 8:04 am
by oceanclub
Just bumping this 7 years later! It really would be useful if "year" was added as a system variable.

P.