If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Logic for next 7 Days

Started by diasbrad, 09 Jan 2015 02:17:10 AM

Previous topic - Next topic

diasbrad

Hi Friends,

I have a report where I need to generate next 7 days date.

For example I have a prompt Value 20-11-2014. then the query should generate the following 6 days automaticly.

So the out put should look like this

Date Field
20-11-2014 (Prompt date)
21-11-2014 Auto Generated by query
22-11-2014 Auto Generated by query
23-11-2014 Auto Generated by query
24-11-2014 Auto Generated by query
25-11-2014 Auto Generated by query
26-11-2014 Auto Generated by query

Is this possible in report studio

Thanks & Regards
Brad

BigChris

[Date] <= _add_days(?prompt_date?,6)

diasbrad

Thanks Chris for your reply.

I do not want to get the date from the database I want to create dummy dates based on the prompt value that the user inputs.

Example if a user enter a date 20-November-2014 the frist day i.e. 20-November-2014 will be displayed as per prompt value and the next 6 days date will be auto generated .

The function that you mentioned will only work if there is  data in the database. Even if data is not present in the database it should show me 7 day dummy date by default.

Thanks & Regards
Bradley

spmaganti

#3
Usually

1. You need to get the dates from a calendar from the database or
2. You could build a custom calendar in FrameWork manager if you have access to modify the package

If not try and use this SQL in the report studio with Query (SQL). This is for an oracle db

SELECT
    to_date(#sq(prompt('SelectedDate','date'))#,'yyyy-mm-dd') + 6 - LEVEL "Date List"
FROM
    dual CONNECT BY LEVEL <= 6

My two cents

akash_d

Hi,

For what it's worth, you can generate the day for next 7 days using Javascript. The logic can be something like this:

Consider your prompt is dtToday.

Add a hidden Date time picker prompt and add folowing code to the Javascript you call for validation after clicking submit.

var dtTomorow = new Date( dtTodayUTC.getUTCFullYear(),dtTodayUTC.getMonth(),dtTodayUTC.getDate() + 1 );

var strTomorow = [dtTomorow.getUTCFullYear(), dtTomorow.getMonth()+1, dtTomorow.getDate()].join("-");

pickerControlEndPrompt.setValue( strTomorow );
timePickerEndPrompt.setValue( eTime );


This method is useful if you don't want to use the database for fetching the next 7 days.

Hope this helps  :)