How do I programmatically generate a dataset in a SSRS report? - sql

I want to execute a SQL query and use the results of that query to generate my own dataset for use in a SSRS report.
More specifically, I'm trying to create a SSRS report subscription calendar. The calendar will display when certain subscriptions are scheduled to run.
I plan to do this by querying the report server's schedule table and generating a row for each scheduled run.
e.g. Subscription A runs every weekday at 2pm. Subscription B runs every Monday at 9am.
This is the dataset I want to generate for some arbitrary week:
Monday Sep 14, 9:00:00, Subscription B
Monday Sep 14, 14:00:00, Subscription A
Tuesday Sep 15, 14:00:00, Subscription A
Wednesday Sep 16, 14:00:00, Subscription A
Thursday Sep 17, 14:00:00, Subscription A
Friday Sep 18, 14:00:00, Subscription A
Is this possible?

Is the following article useful regarding querying the report server the reports are hosted on/in
Query SSRS Report Schedules

Related

Schedule a task to run two times a day between two date

I use SQL Server 2017. I need to schedule a job to run at 12am and 12pm for each days between 7th and 27th of each months. In the other word, i need to run my job two times per day between two date in each month.
Can i do that in one schedule task or I have to create a two jobs for each exact day?
12 am 7th month
12 pm 7th month
and so on and so on.
If i have to create a job for each hover of each day i will have several schedule.
Update 1: I did it by creating several steps in schedule tab but i am looking to do that in less steps.
Update 2:
If i can create two steps like below it will good for me.
1 : Occurs every month between 7th and 27th at 12 am
2 : Occurs every month between 7th and 27th at 12 pm
One way to do that is to check if the date is in between 7th and 27th using DATENAME or DATEPART.
--IF (DATENAME(DAY, GETDATE()) >= 7 AND DATENAME(DAY, GETDATE()) <= 27)
IF DATEPART(DD, GETDATE()) BETWEEN 7 AND 27
BEGIN
EXEC [Your Stored Procedure]
END
And then set the Daily frequency to start at 12:00 AM and Occurs every 12 hours.

Crystal Reports, Record display dates from Monday to Friday every Friday

I have created a report with multiple records in Crystal Reports 2016 SP6.
I would like to Format the record {Orders.DeliveryDate} so it only displays days from Monday to Friday.
I have tried formulas like:
{Orders.DeliveryDate} = DateAdd ("ww",7,CurrentDate) which just show up blank.
The premise of the report is so a company can get their machines prepared on Friday by knowing what orders are coming in on Monday - Friday.
Image of the records on the report.
Found a Formula that works
{Orders.DeliveryDate} >= Maximum(LastFullWeek) + 8 and
{Orders.DeliveryDate} <= Maximum(LastFullWeek) + 14

Custom Week Number in SQL

I am trying to add a column to my data set that has a custom week number based on a specific start date.
For example, lets say that that a product launched Thursday September 6, and I want to measure signups by week. In this case, I would want September 6 - September 12 to be Week 1, September 13 - 19 as week 2, etc.
The two options I have found are using the datefirst function and creating a custom calendar table, but which of these would be easier to implement and more efficient?
Thanks!
Much better if you use date first - date end so that the users can also understand it easily.

Find last 10 business days of the current month for schedule

I have a couple of scenarios
Scheduler should compare the current day is with in the last 10 business days of the current month then it should schedule to run current day with 11AM CST.
(E-g) current day : 18th July 2017 (with in last 10 business days) should run and reschedule at 19th July 2017 11.AM CST
IF Last business day(30th or 31st) after runs the scheduler should reschedule it to next month.
(E-g )current day : 31th July 2017 (with in last 10 business days) should run and reschedule at 18th Aug2017 11.AM CST
Can any one help to derive the logic in oracle 11g scheduler?
Thanks in Advance.

DBMS Scheduler logic required

I need to set up a due date concept using DBMS scheduler below is the requirement .please suggest how I can achieve this using DBMS scheduler.
I am planning to pick this date from dbms_scheduler tables where it should calculate the date and hold in some column for referencing.
Requirement
The due date needs to change every 6 months:
For June: Last working Friday
For Dec: Second-week ending date on Friday
e.g. For 2016 it should be 24 June 2016 & 9 Dec 2016