I would like to default a prompt FY year/month selection to the current FY period. Date dim has FY Period as YYYYMM field and that is what I am displaying.
I would like to set the default selection for the prompt to always be that current FY period.
Is there a way using the #prompt () # that this can be done in C8? Thank you for any assistance in this matter
I recently did a report where the user wanted the begin_date prompt to automatically default the first day of the current month and the end_date prompt to default to the current system month. I solved this by using a HTML tag immediately after each prompt and defining the tag with the following JavaScript:
begin_date:
<script language="javascript">
//Default is today
var dDate = new Date();
dDate.setDate(1);
pickerControlStartDate.setValue(getFormatDate(dDate, 0 , 'YMD'));
</script>
end_date:
<script language="javascript">
var dDate = new Date();
//Get date 1 month later
dDate.setMonth(dDate.getMonth() + 1);
//Switch to first of next month
dDate.setDate(1);
//Subtract 1 to get last of current month
dDate.setDate(dDate.getDate() - 1);
pickerControlEndDate.setValue(getFormatDate(dDate, 0 , 'YMD'));
</script>
Now the trick is to go to properties pane of each prompt and the last field 'Miscellaneous" Name value gave the begin_date = StartDate and the end_date = EndDate (you will see this defined in the above code for each prompt).
I got this tip from "IBM Cognos 8 Report Studio Cookbook" by Abhishek Sanghani on PACKT Publishing. I hope you can play around with this and see what happens.
Here is an IBM link that may help:
https://www-304.ibm.com/support/docview.wss?uid=swg21342809