Automator Export Naming - Need Next months month number

Melissa_21551
Melissa_21551 New Altair Community Member
edited June 2017 in Community Q&A

I have an automator export that I need to include a month in the naming of the xlsx export.  I currently have the export name as "Monthly PMI.&[mm].&[yy].xlsx"

 

So if it runs today the name would be Monthly PMI.06.17.xlsx

 

What I need is for the date in the name to include next month not the current month.  so: Monthly PMI.07.17.xlsx

 

Is there a macro I can use to achieve this?

 

 

Melissa Falardeau

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    Try "Monthly PMI.&[mm.+m.&[yy.+m].xlsx"

    To adjust by day use d, month m, year y but make sure you do it for each part of the date or you may have the prior year for example. you can do + or - for what you need.

     

    Let me know if that works.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    Try "Monthly PMI.&[mm.+m.&[yy.+m].xlsx"

    To adjust by day use d, month m, year y but make sure you do it for each part of the date or you may have the prior year for example. you can do + or - for what you need.

     

    Let me know if that works.

    Monthly PMI.&[mm.+1m].&[yy].xlsx

     

    This was an enhancement in v14.x to include Offset Expressions in Macros.  If you are on an earlier version then the above suggestions will not work.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    Monthly PMI.&[mm.+1m].&[yy].xlsx

     

    This was an enhancement in v14.x to include Offset Expressions in Macros.  If you are on an earlier version then the above suggestions will not work.

    Thank you Chris!  This worked!

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    Try "Monthly PMI.&[mm.+m.&[yy.+m].xlsx"

    To adjust by day use d, month m, year y but make sure you do it for each part of the date or you may have the prior year for example. you can do + or - for what you need.

     

    Let me know if that works.

    Thank you!  Will this work for December - to roll the month and year?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    Thank you Chris!  This worked!

    All credit goes to Patrick for reminding me about the offsets.  I just added some extra detail.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    Thank you!  Will this work for December - to roll the month and year?

    The offsets only work on the individual macro itself and not the entire string.  I did some testing to generate a report with today's date &[yyyy]&[mm]&[dd] and then again with today's date +7 months &[yyyy]&[mm.+7m]&[dd] .  The results showed:

    Today's date: 20170622.xlsx

    Today+7 months: 20170122.xlsx

     

    Basically the month did rollover to January, but did not increase the year.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    The offsets only work on the individual macro itself and not the entire string.  I did some testing to generate a report with today's date &[yyyy]&[mm]&[dd] and then again with today's date +7 months &[yyyy]&[mm.+7m]&[dd] .  The results showed:

    Today's date: 20170622.xlsx

    Today+7 months: 20170122.xlsx

     

    Basically the month did rollover to January, but did not increase the year.

    if you add the .+7m to the year, &[yyyy.+7m] it will give the year for 7 months from now. I didn't test this but when I do &[mm.-d]&[dd.-d]&[yy.-d] it has always given me the correct date for yesterday.

     

    good thinking about the different versions, I didn't realize that this was the first version with it.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    if you add the .+7m to the year, &[yyyy.+7m] it will give the year for 7 months from now. I didn't test this but when I do &[mm.-d]&[dd.-d]&[yy.-d] it has always given me the correct date for yesterday.

     

    good thinking about the different versions, I didn't realize that this was the first version with it.

    Patrick,

     

    Thank you very much.  This worked!!