COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => SDK => Topic started by: hnawaz on 26 Feb 2017 09:13:42 PM

Title: Cognos SDK schedule object properties
Post by: hnawaz on 26 Feb 2017 09:13:42 PM
Hey Folks, I'm working on a SDK .Net app for scheduling.  Based on the samples provided by IBM I'm able to schedule reports on daily basis.  But I want the extend this to week and month.  I'd really appreciate if someone can provide, or guide me on setting weekly and monthly nmtoken values.  Please let me know if you need more information. Thanks for your time.

Below code sets nmtokenProp for daily schedule.
// a few more sched options.
nmtokenProp tp = new nmtokenProp();
nmtokenProp dailyPeriod = new nmtokenProp();
active.value = true;
dailyPeriod.value = "minute";
frequency.value = "10";
startDate.value = DateTime.Now.Date;
tp.value = "daily";

Title: Re: Cognos SDK schedule object properties
Post by: Andrew Weiss on 27 Feb 2017 08:36:35 AM
Hnawaz,

This is pretty easy to accomplish with JavaScript using MetaManager's API over Cognos.  More details here:
http://www.bspsoftware.com/products/metamanager/API/

To help with the SDK approach you'll need to set the type to "weekly"

nmtokenProp tp = new nmtokenProp();
tp.value = "weekly";

Then set the boolean values for weeklyMonday through weeklySunday

Set the integer property everyNPeriods for the "Every n weeks" part

Thank You,
-Andy



Title: Re: Cognos SDK schedule object properties
Post by: hnawaz on 27 Feb 2017 07:21:31 PM
Hi Andrew,

Thanks for the reply. It helped me figure out the weekly bit of the schedule. But I'm not having any luck with Monthly part.  I'm trying to set a schedule on day one of every month with below code and it's throwing a generic error. Am I missing a parameter for monthly schedule. Thanks.

          // sched options.
            active.value = true;
            day.value = "1";
            frequency.value = "1";
            startDate.value = DateTime.Now.Date;
            tp.value = "monthly";


            sched.active = active;
            sched.monthlyAbsoluteDay = day;
            sched.everyNPeriods = frequency;
            sched.type = tp;
            sched.startDate = startDate;


Title: Re: Cognos SDK schedule object properties
Post by: hnawaz on 02 Mar 2017 09:41:19 PM
For anyone pulling his/her hair on this; monthly type value is "monthlyAbsolute".  I guess IBM wants sdk to be a black box for .net folks at least.