Running %UpdateStats using PeopleCode

Hi folks! The other day I had a requirement to run UpdateStats using an Application Engine process. Since my AE involved a lot of complex SQL based processing, I had placed the %UpdateStats meta-SQL inside the PeopleCode action. I searched far and wide for a way to execute %UpdateStats from PeopleCode, but I kept getting errors.

I’ll update this post later with those errors. Now, I couldn’t place UpdateStats() inside any SQL action since my code involved multiple SQL-based processing. My only option was to run it using SQLExec() function in PeopleCode.

I first tried,

&recname = "JOB";
SQLEXec("%UpdateStats(:1)",&recname); 

But, didn’t work 😦

Then, I substituted the record name directly and it worked!

 SQLExec("%UpdateStats(JOB)"); 

This would come in handy when you have only one record to run UpdateStats – what if you have had multiple dynamically populated records?

And, the answer?

 &recname = "%UpdateStats("|&recname|")";
SQLExec(&recname); 

Worked like a charm! Interesting right? 🙂

Have fun! 🙂

Advertisements

About Manikandan Surendren

A PeopleSoft Techno-functional Consultant. An engineering graduate in Computer Science. Technology Enthusiast. Movie freak. Gadget geek.
This entry was posted in Code, PeopleSoft. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s