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!
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! 🙂