Thursday, March 31, 2011

Stupid Programming Tricks #8

Introduction to the introduction

I wrote this (or as you’ll see in a minute, I didn’t  write this) quite a while ago and was holding off on releasing it because…well because I had other things to post.

Now I see that Robb Salzmann has posted something pretty similar to what I-didn’t-but-someone-else wrote.

Think of this as an alternate take on his post, or his post is an alternate of this post.  You decide.

Introduction

Are you an Antimimetic or a Mimetic?  In other words, does art imitate life, or life imitate art?  

I’m pretty sure my name isn’t Tom Sawyer, and yet I manage to get others to whitewash Aunt Polly’s fence.

This time it’s Frank Chow who’s done all of the hard work.

The problem

Set substitution variables for the current Actual month and year.  Big deal, right?  Any automated system worth its salt does this.  

But where do those dates come from?  Manual assignment?  Magic?

Frank went for code (Is there really any other way?) and had an additional requirement – that the current month increments on the 25th of the month.  And oh yes, and it had to handle the extra-special case of January.

NB – The fiscal year is the same as the calendar year.  It has to be for the solution below to work as you’ll shortly see.

The solution

DOS will never die, will it?  It is breathtakingly cryptic and quite powerful in its limited way.  What’s not to love?  

Let’s dive in:

Setup the Day, Month, and Year variables

:: ********************* Set up the Day, Month, Year Variables **************************
   FOR /f "tokens=1-4 delims=/ " %%a in ('date /t') do (
    set day=%%a
    set mm=%%b
    set dd=%%c
    set yy=%%d
    )
                                                                             
 set /a pr_mm=%mm%-1
 set /a pr_yy=%yy%-1
Pretty cool stuff here – the code is stripping the output of date /t using the backslash as a delimiter and then putting the day, month number, day number, and two digit year into four temporary variables.

Setting up the strings

:: ***************** set up mapping table ************************
  set monthmap=00-Dec;01-Jan;02-Feb;03-Mar;04-Apr;05-May;06-Jun;07-Jul;08-Aug;09-Sep;10-Oct;11-Nov;12-Dec
::*************** set current month variable ************
 CALL SET cur_month=%%monthmap:*%mm%-=%%
 SET cur_month=%cur_month:;=&rem.%

::*************** set prior month variable **************
 CALL SET pr_month=%%monthmap:*%pr_mm%-=%%
 SET pr_month=%pr_month:;=&rem.%

echo current_month: %cur_month%
echo prior_month: %pr_month%

::*************** set current & prior year variables ***********
 set cur_yr=FY%yy:~-2%
 set pr_yr=FY%pr_yy:~-2%

echo current_year: %cur_yr%
echo prior_year: %pr_yr%
Here a key-value pair is used with CALL SET to translate the month numbers in the variable %mm% to three character strings and is also used to append “FY” to the two digit year values in %yy%.

Here’s a good guide to string manipulation.  You’ll find a section similar to the above in the example called “Map and Lookup - Use Key-Value pair list to lookup and translate values”.

Handle month end and January special case

::************ set up CurrActMonth & CurrActYear variables ***************                                                                                         
 IF %cur_month% EQU Jan goto Var_Jan
 IF %dd% LSS 25 goto before25
 IF %dd% GEQ 25 goto after25
 
:Var_Jan
 IF %dd% LSS 25 goto before25_Jan
 goto after25

:before25_Jan
 SET CurrActMonth=Dec
 SET CurrActYear=%pr_yr%
 goto End
  
:before25
 SET CurrActMonth=%pr_month%
 SET CurrActYear=%cur_yr%
 goto End
  
:after25
 SET CurrActMonth=%cur_month%
 SET CurrActYear=%cur_yr%
 goto End
:End

echo CurrActMonth: %CurrActMonth%
echo CurrActYear: %CurrActYear%

Ever wonder what the DOS commands are for >, >, <>, etc.?  Check them out here.

Run it if needed

:: ***************** Excute the MAXL script if the date is 25th ***********************
 IF %dd% EQU 25 goto MAXL_update_date
 exit

REM /============ excute MAXL script to update the Substitution Variables ======================/
:MAXL_update_date
 essmsh SubVar_CurrActMonth_Year.msh
This code gets run every night.  If it’s the 25th, run the MaxL code, otherwise exit.

Do it in MaxL

/* --------------------------------------------------------------------------
*  LOGIN AND SETUP SCRIPT VARIABLES - &CurrActMonth and &CurrActYear
* -------------------------------------------------------------------------- */

/* NB -- user, password, and server are set up separately as Windows
  environment variables.    */
login "$ESS_USERID" "$ESS_PASSWD" on "$ESS_SERVER";

/* ---------------- SET UP SUBSTITUTION VARIALBES --------------------------- */
alter system set variable 'CurrActMonth' $CurrActMonth;
alter system set variable 'CurrActYear' $CurrActYear;

logout;
exit;
Remember, the Windows CMD script code set the temporary OS environment variables CurrActMonth and CurrActYear.  These are referenced in MaxL with a “$” in front of the variable name.

Conclusion

This code does three things:
  1. Figures out the current month and year based on system date
  2. Uses some cool DOS functions
  3. Sets Essbase substitution variables if it’s the 25th of the month and oh by the way handles year end pretty well


Frank asked me what I thought about it – was it any good, could I make improvements, etc.  Some say the greatest form of flattery is imitation.  Is ripping code off and using it yourself an even greater form of flattery?  Whatever your definition, I plan on using this code when I have the same need.

You can get the whole code stream here.  Run it with the PAUSE statements in to understand what it’s doing – take those statements out when you want to use it.

Saturday, March 26, 2011

Stage 6 Catalyuna

For the last 3 days here in the tour of catalyuna we have been seeing how fast we can cover the first 70km!! well not really but thats how long it has taken for the break to form thanks to the multitude of attacks and strength of the cntroling teams saxo bank, lampre, radio shack, and movistar. Stage 4 was a flying start, yesterday even harder and today raised it to another level. It was so chaotic that after 50km when we hit the first climb the favourites had all formed at the front and attacks came from noe other than contador the race leader, scarponi 2nd, and all the other riders in the top ten. I was fortunately in a good positionabout 5 wheels behind contador so could keep my position in the front of the bunch behind the peleton had shattered and after 70km when 3men finally skipped away only 40riders remaind in the front with 3 groups chasing behind. With almost all the bullets from the big guns fired a cease fire was called and we thankfully rode a nice normal speed to finish and the bunch sprint ensured. My role for the day was firstly to look for a break that would go to the finish and if not which was obvious from the get go was not going to happen today do my usual job of looking after the bassinator and keeping him out of trouble. We seem to have a good system orking now so life in the bunch these past few days has been alot less stressfull for the both of us which is nice. Was nice to get a good hitout in the first 70km today particualy on the climb as appart from when i i have to ride on the front it was the first time in the race that i have felt appart of the action and got the adrenoline pumping. It is always a good mental and physical challenge particually at the protour level and the calibar of stage race riders at this race going flat out and trying to hang in there having no idea when the pressure is going to let up. Being at the front of it always makes life a bit easier as you are literally seeing the front of the race and this always gives you a little lift so all in all it was a very enjoyable day for and nice to open up the old pins on a climb for the first time this year. Not having done a stage race of this level since the giro last year the body quickly forgets how much suffering is involved in this sport but all you can hope each season is to get your body used to it again sooner rather than later. Tomorrow i am sure will be a sprint with the finish on la rumbla right in the heart of barcellona so will be a good day. How long the break will take to form is anyones guess but i think we should see if we can crack the centuary. I am looking forward to good rest on monday

cjw

Tuesday, March 22, 2011

Friends, Geeks, EPM Practitioners, lend me your ears


With profuse apologies to William Shakespeare

I come not to bury Glenn Schwartzberg, but to praise him,
The good that men do lives after and with them,
Glenn’s good  is visible in his deeds and actions,
So let it be with Glenn, the latest BI Oracle Ace Director!

Oracle’s words about the Oracle Ace Director award

Oracle ACE Directors are individuals who not only meet the requirements of an Oracle ACE (that is, a track record of advocacy), but who can also commit to future participation in an ongoing dialog between Oracle and the people who use Oracle Technology or Applications in the "real world." Most Oracle ACE Directors have also made extraordinary contributions of some kind, whether technical or community-oriented. As with Oracle ACEs, employees are not eligible.   

And now my words

The above is just the beginning.  Read all you ever wanted to know about Oracle Ace Directors here.  Glenn has received a great honor but as it so often goes, much will be expected from him.  I have not the slightest shred of a doubt that he will excel in this role as he has in all others.

In case you haven’t noticed, I am excited and happy for Glenn and cannot think of anyone else who deserves it more.  The funny thing is he will likely want to hit me for writing all of this, but that’s just another aspect of his personality that I like so much – he is modest to a fault.

I’ve only known Glenn for just over two years, but they have been two very special years.

Glenn has given of himself tirelessly, cheerfully, and constantly to me, perfect strangers on the web, and to the Oracle EPM community in general.  We are lucky to have him.

He has been an inspiration to me and others and I count him amongst the handful of people in this business that I view as a role model.  Yes, Glenn, even when I go off the rails, I think to myself, “Good grief, that was dumb.  What would Glenn have done?”

The encomium is finished

This is a big deal, in case you haven’t figured it out.  As near as I can figure it, Glenn is now the fifth Oracle Ace Director in the EPM space (although the category is formally BI I draw a distinction between the BI and EPM worlds).

I’ve worked with all four of the other EPM Ace Directors (Eric Helmer, Tracy McMullen, Edward Roske, and Tim Tow) and they are all the most deeply talented and dedicated people I have ever met.  Glenn joins this august group as an equal.

Glenn, congratulations!  

Now that’s out of the way, I have this question about Essbase…

Friday, March 18, 2011

My name isn’t Chicken Little

Nor is it Henny Penny, Cocky Lockey, Ducky Lucky, Drakey Lakey, Turkey Lurkey, or Goosey Loosey and it definitely isn’t Foxy Loxy.  And no, overwork hasn’t landed me in the looney gooney bin yet.  But there is a metaphorical sky, and it’s falling right down on your head if you haven’t signed up for KScope 2011.

But you better hurry up

Why?  The Early Bird registration ends in just a few short days, at the end of the 25th of March, to be exact.  Miss that date and you are forgoing a lot of savings.

How much money can you save?  

Early Bird Registration Rates-Ends March 25, 2011:
ODTUG Full Member Rate: $1,400
Non-Member Rate: $1,550

Advanced Registration Rates-March 26-June 9, 2011:
ODTUG Full Member Rate: $1,700
Non-Member Rate: $1,850

Standard Registration Rates-After June 9, 2011:
ODTUG Full Member Rate: $1,950
Non-Member Rate: $2,100

Let’s review the math

If you sign up before 26 March, you save:  $550.00.

If you sign up before 10 June, you save:  $250.00.

If you sign up after 10 June, you save:  zip, zero, zilch.  Bummer, but you did procrastinate, didn’t you?

Quit your lollygagging

You know (oh, if you’ve been reading my blog at all, you know) that KScope 2011 is the best conference for Oracle EPM content ever, so I will not reiterate the symposiums, panels, presentations, social events, exhibitors, and entertainment that make KScope 2011 the ne plus ultra of “Hyperion” conferences.

And, since you know that, I don’t doubt for one moment that you already have that credit card/P.O./check/fistful of dollars/bag full of sovereigns ready to plunk down on the barrelhead and save, save, save.  Here’s the link for registration.  Git goin’!

I can’t wait to see you there, with pockets a-flush with all the money you saved.  :)

Sunday, March 13, 2011

Why you should be at KScope11

If you’ve read this blog at all, you’ve heard me blather on and on about how wonderful ODTUG Kaleidoscope is and why you should go.  Yes, I am not shy about my enthusiasm for the conference.

I’m not the only one who likes KScope11.  How about hearing what other people have to say about this most excellent of Oracle conferences?  ODTUG’s President and author of the ODTUG Blog, Mike Riley, has been interviewing some Oracle community luminaries (and an exception – no points if you can guess who the 5 watt bulb might be) about:
  • The thing they like most about KScope.
  • What presentations they are looking forward to the most.
  • Have they ever been to Long Beach, California.
  • What their best ODTUG Kscope moment has been.

Who are these august few?  People just like you, that’s who.

Who do I mean?

Check out the responses to Mike’s questions.  The passion for Kscope11 runs deep and swift.  If you were on the fence re coming to KScope 2011, I’ll bet a read of one or two of the above ought to push you over onto the side of signing up right now, before the 25 March 2011 deadline for the Early Bird Registration.  

I know I’ll see you there this year.  :)

Monday, March 7, 2011

Stupid Programming Tricks #7

The Warning Before the Introduction Along With An Advertisement

Is it bad to start off a blog post with a recommendation to not read that very same blog post?  Oh well, here goes:  If you use Calc Manager in Planning this post is a complete waste of time as you have already figured all of this out. 

May I suggest spending your time doing something more constructive, like thinking about how you are going to go to the most awesome Oracle EPM conference in the whole wide world, i.e., ODTUG KScope, and see over 100 EPM and BI presentations, experience seven half day labs, attend multiple symposiums, party like a crazy EPM geek at Monday Night Madness, drink deeply of the Functional and Technical content, and oh yeah, visit http://www.kscope11.com/biepm for more information.  Hmm, that wasn’t very subtle.  I wonder who inspired me to write this?

For the rest of us, no one should spend the 30 minutes I did trying to figure this out.  The Happy Few still ought to contemplate the awesomeness that is ODTUG Kaleidoscope.

Introduction

With that preamble out of the way, for those of you who know and love EAS (is there anyone who *loves* EAS?) also know that EAS' days are numbered.  How many that may be is up to Oracle product management, but it's time to at least think about moving on down the road.

EAS and Hyperion Business Rules

With that thought (the wordplay is breathtaking) in mind, I was playing around (no life at work here but I know I'm not the only one) with Calculation Manager and was wondering -- where does security get assigned in Calc Manager for Planning?  How do I give the Planner John Q. Public access to a particular Business Rule?

For those of you who don't use EAS/traditional HBRs, security assigns look like:

To show the above, I right clicked on the HBR "ClrFinal", opened up the rule, clicked on the tab Access Privileges, and then clicked on Add to grant one of the many, many, many users in my VM.

Calculation Manager

That's fine, but where on earth do you do it in Calc Manager?  It can't be in EAS because that's the whole (well one of the) point.  Business rules aren't in EAS, they're kind of, sort of part of Workspace.
Well, when I go into Workspace, and then go to Calc Manager, security is AWOL:

Don't get fooled by that Change Owner -- that does just what it says and has nothing to do with Planner John Q. Public being able to run a rule.


So how do you do you assign access?

First, deploy the rule (you do not need to be using the Devil's Own, aka EPMA to do this as Calc Manager has its own deployment functionality) to the Planning application.

Secondly, go into Planning as an administrator and click on the Administration menu.  Do you see it?


I hope so, I highlighted it in red.  :)

Is this menu choice in Planning in non-Calc Manager Planning apps?  Nope.

Okay, going back to Calc Manager-enabled Planning apps.  Select Business Rule Security:

This is beginning to look familiar.  Select the business rule (maddeningly, just like forms, you cannot select multiple rules) and then click on the "Assign Access" button.

You will then see the standard access assign dialog box that you know and love for member security, forms, etc.


If you click on "Add Access" you will note that there are only two actions a Planner can make -- Launch or No Launch.  You don't see anything here because in Calc Manager, admins can't have access to a Calc Manager rule, just like they can't have access to a form -- they are above security.  This is at least consistent with the way Planning works for other objects and a big improvement over HBR’s crazy you-can-write-the-rule-but-not-launch-or-validate-it-till-you-give-yourself-rights-to-it model.

To my point about the oddness that was once known as Hyperion Allocations Manager, aka, HAM, this is different than EAS' HBR security, which can assign validation/launch and modify access.

So where is the provisioning for modifying the rule?  It's driven by Shared Services roles.

Phew, a lot of writing for a very simple thing.  But I've saved you 1/2 hour of your life, so you owe me.

Addendum

P.S.  Extra credit, and again, if you use Calc Manager you already know this one -- did anyone catch the weird thing about the screenshot for assigning security access in Planning versus the HBRs available in Calc Manager?  This is a fairly well known bug as documented here:  http://forums.oracle.com/forums/thread.jspa?messageID=6685183&#6685183  No, I have not patched my VM to fix this.

Popular Posts