Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys, I have a bookmark that gets the two last months of the current year.
So my bookmark is :
Year : 2011
Month : apr,may
What about if when last month changes to june? I would like to automatically get the last two months in my bookmark, and not create a brand new bookmark with my new desired selection.
Many thanks in advance!!
Correct; you will need to do it in the load script. Obviously you'll want to make these calculated in your script instead of hard-coded based on some other date (e.g. today() or something similar.)
Just on a semantic note, I would name your fields as "MonthCounter" or something similar; using the convention you used above I would expect a 1 if in the current year/month otherwise a 0. The purpose for the counter is a bit different. But very useful, counterfield = -1 always returns the prior period.
-Isaiah
Hi Marcel - I don't think you can include the explicit values in your bookmark, however you have a few other options.
Probably best would be to use some calculated fields in your loaded data. For example a "month counter" that would have maybe 0 for the current month and -1 for the prior month, etc. Or you could "Current Month" and "Last Month" for a more friendly display. Then you could filter on the derived field for your bookmark. Every time the document reloads these would be recalculated making them dynamic. Let me know if that doesn't make any sense.
Alternatively sometimes for this purpose I scap the bookmark and instead use a macro to make the dynamic selections. You would have to trigger this with some action instead of using a bookmark. Maybe not the best solution here, but the nice thing is that your selections reflect the actual month values (e.g. apr,may.)
-Isaiah
Do you mean to do it inside the load script? Something like.
Year Month CurrentYear CurrentMonth
2011 jan 0 -4
2011 feb 0 -3
2011 mar 0 -2
2011 apr 0 -1
2011 may 0 0
Where 0 is current, -1 is current-1, and so on??
Correct; you will need to do it in the load script. Obviously you'll want to make these calculated in your script instead of hard-coded based on some other date (e.g. today() or something similar.)
Just on a semantic note, I would name your fields as "MonthCounter" or something similar; using the convention you used above I would expect a 1 if in the current year/month otherwise a 0. The purpose for the counter is a bit different. But very useful, counterfield = -1 always returns the prior period.
-Isaiah
Many thanks Isaiah. This is what I wanted to do.
Regards, Marcel.
Hi,
great Tip, simple and effective!
Regards