<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cogniza &#187; Parameters</title>
	<atom:link href="http://cogniza.com/wordpress/tag/parameters/feed/" rel="self" type="application/rss+xml" />
	<link>http://cogniza.com/wordpress</link>
	<description>Business-Intelligence Specialists</description>
	<lastBuildDate>Sat, 30 Apr 2011 13:22:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Business Objects Enterprise: Create a Dynamic List of Date Ranges</title>
		<link>http://cogniza.com/wordpress/2006/05/24/business-objects-enterprise-create-a-dynamic-list-of-date-ranges/</link>
		<comments>http://cogniza.com/wordpress/2006/05/24/business-objects-enterprise-create-a-dynamic-list-of-date-ranges/#comments</comments>
		<pubDate>Wed, 24 May 2006 17:38:23 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Business Objects Enterprise]]></category>
		<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[Business Objects]]></category>
		<category><![CDATA[Business View]]></category>
		<category><![CDATA[Date/Time]]></category>
		<category><![CDATA[Parameters]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=61</guid>
		<description><![CDATA[Add a dynamic, date-range parameter to a report which includes the most recent 12 months, plus Crystal Reports' Month-to-Date and Year-to-Date ranges.]]></description>
			<content:encoded><![CDATA[<p>Add a dynamic, date-range parameter to a report which includes the most recent 12 months, plus Crystal Reports&#8217; Month-to-Date and Year-to-Date ranges.</p>
<p><a href="/wordpress/wp-content/uploads/2006/05/Date-Range%20Parameter.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Date-Range%20Parameter.png" alt="Date-Range Parameter" id="image62" border="0" height="90" width="128" /></a><span id="more-61"></span></p>
<h2>Objective</h2>
<p>Give the report</p>
<h2>Instructions</h2>
<h3>Create the Sql Server Components</h3>
<p>A Sql Server user-defined function (see <a href="http://www.cogniza.com/wordpress/2006/05/25/sql-server-dateranges-function" target="_new">Sql Server: DateRanges Function</a>) will dynamically create the values that are needed for the this project. This function needs a Sql Server view (see <a href="http://www.cogniza.com/wordpress/2006/05/25/sql-server-getnow-view" target="_new">Sql Server: GetNow View</a>) to generate the system&#8217;s current date/time.</p>
<h3>Create Data Connection</h3>
<ol>
<li>Open the Business View Manager and log in.</li>
<li>Create a new Data Connection.</li>
<li>Configure the Data Connection to attach to the appropriate Sql Server database.</li>
<li>Save the Data Connection as &#8216;Sql Server DC&#8217;.</li>
</ol>
<h3>Create a Data Foundation</h3>
<ol>
<li>In the Business View Manager, create a Data Foundation.</li>
<li>Select &#8216;Sql Server DC&#8217; as the Data Connection.</li>
<li>Save the Data Foundation as &#8216;Sql Server DF&#8217;.</li>
</ol>
<h3>Create a Business View</h3>
<ol>
<li>In the Business View Manager, create a Business View.</li>
<li>Save the Business View as &#8216;Sql Server BV&#8217;.</li>
</ol>
<h3>Create a Command Object</h3>
<ol>
<li>Create a Command Object in the Data Foundation. Add the following text to the Command Object:</li>
<p><code>SELECT *<br />
FROM dbo.DateRanges()<br />
ORDER BY Sequence DESC </code></p>
<li>Save the Command Object as &#8216;DateRanges&#8217;.</li>
</ol>
<p><a href="/wordpress/wp-content/uploads/2006/05/Create%20Command%20Object.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Create%20Command%20Object.thumbnail.png" alt="Create Command Object" id="image65" border="0" height="80" width="128" /></a></p>
<p><a href="/wordpress/wp-content/uploads/2006/05/Data%20Foundation.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Data%20Foundation.thumbnail.png" alt="Data Foundation" id="image75" border="0" height="94" width="128" /></a></p>
<h3>Create a Business Element</h3>
<ol>
<li>Create a new Business Element in the Business View Manager.</li>
<li>Add the Description and Value fields from the &#8216;DateRanges&#8217; Command Object.</li>
<li>Save the Business Element as &#8216;DateRanges&#8217;.</li>
</ol>
<p><a href="/wordpress/wp-content/uploads/2006/05/Business%20Element.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Business%20Element.thumbnail.png" alt="Business Element" id="image63" border="0" height="94" width="128" /></a></p>
<h3>Add Business Element to Business View</h3>
<ol>
<li>Open the Business View.</li>
<li>From the &#8216;Insert&#8217; menu, select &#8216;Insert Business Elements&#8230;&#8217;.</li>
<li>Locate and select the &#8216;DateRanges&#8217; Business Element, click &#8216;Add&#8217;, then &#8216;Close&#8217;.</li>
</ol>
<p><a href="/wordpress/wp-content/uploads/2006/05/Business%20View.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Business%20View.thumbnail.png" alt="Business View" id="image64" border="0" height="94" width="128" /></a></p>
<h3>Create the List of Values</h3>
<ol>
<li>Create a new List of Value in the Business View Manager.</li>
<li>Select the desired Business View from the &#8216;Select Business View&#8217; window.</li>
<li>Enter &#8216;Date Range LoV&#8217; in the &#8216;Name&#8217; textbox.</li>
<li>Expand the &#8216;DateRanges&#8217; Business Element in the &#8216;Available Fields&#8217; list.</li>
<li>Select &#8216;Value&#8217;, then click the &#8216;&gt;&#8217; button.</li>
<li>Check &#8216;Sort by Value in Descending Order&#8217;.</li>
<li>Choose &#8216;Description&#8217; from the &#8216;Description Field&#8217; dropdown list.</li>
<li>Click &#8216;OK&#8217; to save the List of Values.</li>
</ol>
<p><a href="/wordpress/wp-content/uploads/2006/05/Create%20List%20of%20Values.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Create%20List%20of%20Values.thumbnail.png" alt="Create List of Values" id="image66" border="0" height="96" width="112" /></a></p>
<h3>Examine Repository</h3>
<p>Open the Repository Explorer in the Business View Manager.  The list of objects for the Date Range Parameter should resemble this list:</p>
<p><a href="/wordpress/wp-content/uploads/2006/05/Repository%20Explorer.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Repository%20Explorer.thumbnail.png" alt="Repository Explorer" id="image76" border="0" height="96" width="111" /></a></p>
<h3>Create the Dynamic Parameter</h3>
<ol>
<li>Create a new report using Crystal Reports XI.</li>
<li>Connect to the Repository that contains the &#8216;Sql Server BV&#8217; Business View.</li>
<li>Create a new parameter, named &#8216;Date Range&#8217;.  Leave the &#8216;Prompt Group Text&#8217; textfield blank.</li>
<li>Select &#8216;Dynamic&#8217; from the &#8216;List of Values&#8217; dropdown list.</li>
<li>Select the Existing radio button and choose &#8216;Date Range LoV&#8217; from the list.</li>
<li>Click &#8216;Create Parameter&#8217; in the &#8216;Parameters&#8217; column of the &#8216;Choose a Data Source&#8217; group.</li>
<li>Set &#8216;Prompt Text&#8217; to &#8216;Choose Date Range&#8217;.</li>
<li>Set &#8216;Sort Order&#8217; to &#8216;Descending by Value&#8217;.</li>
<li>Set &#8216;Prompt With Description Only&#8217; to &#8216;True&#8217;.</li>
<li>Click &#8216;OK&#8217; to save the parameter.</li>
</ol>
<p><a href="/wordpress/wp-content/uploads/2006/05/Create%20Parameter.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Create%20Parameter.Thumbnail.png" alt="Create Parameter" id="image67" border="0" height="96" width="114" /></a></p>
<h3>Modify the Report</h3>
<ol>
<li>Add the CDateTime Custom Function to the report (see <a href="http://www.cogniza.com/blog/?p=77" title="Crystal Reports: CDateRange Function">Crystal Reports: CDateTime</a>).</li>
<li>Add a Custom Function named &#8216;getDateRange&#8217; (see below) to the report.</li>
<li>Edit the Record Selection Formula. Add the following code:<br />
<code>//set the database field to the value that is extracted from the 'Date Range' parameter<br />
{table.date_field} IN getDateRange({?Date Range})</code></li>
<li>Add a formula field to display the date range.  Add the following code to the formula:<br />
<code>CStr(Minimum(getDateRange ({?Date Range}))) + " - " + CStr(Maximum(getDateRange ({?Date Range})))</code><br />
Add the formula field to the report.</li>
</ol>
<h2>Summary</h2>
<p>When the report is run, the parameter form will resemble:</p>
<p><a href="/wordpress/wp-content/uploads/2006/05/Date-Range%20Parameter.png" target="_new"><img src="/wordpress/wp-content/uploads/2006/05/Date-Range%20Parameter.png" alt="Date-Range Parameter" id="image62" border="0" height="90" width="128" /></a></p>
<p><a href="/wordpress/wp-content/uploads/2006/05/Dynamic%20Date-Range%20Parameter.zip" id="p70">Dynamic Date-Range Parameter Sample</a></p>
<h2>getDateRange Custom Function</h2>
<p><code> '--------------------------------------------------------------------------------<br />
'Author:        Craig <a href="mailto:Buchanan;craig.buchanan@cogniza.com" style="color: #ffcc33" class="linkification-ext" title="Linkification: mailto:Buchanan;craig.buchanan@cogniza.com">Buchanan;craig.buchanan@cogniza.com</a><br />
'Purpose:       Convert a string value into its equivalent Date Range<br />
'Parameters:    text - a string in the format index;startDate:endDate<br />
'               or index;NamedDateRange<br />
'               e.g. 1;1/1/2006:12/31/2006 or 2;MonthToDate<br />
'Returns:       Date Range<br />
'--------------------------------------------------------------------------------<br />
Function getDateRange (text as string) As Date Range<br />
If Instr(text,";")=0 Then Exit Function<br />
Dim value as string: value = Split(text,";")(2)<br />
If Instr(value,":")=0 Then<br />
getDateRange = CDateRange (value)<br />
Else<br />
Dim startDate as Date: startDate = Cdate(Split(value,":")(1))<br />
dim endDate as Date: endDate = cdate(Split(value,":")(2))<br />
getDateRange = startDate to endDate<br />
End If<br />
End Function</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2006/05/24/business-objects-enterprise-create-a-dynamic-list-of-date-ranges/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Crystal Reports: Named-Date-Range Parameters</title>
		<link>http://cogniza.com/wordpress/2005/11/24/advanced-parameter-usage-in-crystal-reports/</link>
		<comments>http://cogniza.com/wordpress/2005/11/24/advanced-parameter-usage-in-crystal-reports/#comments</comments>
		<pubDate>Thu, 24 Nov 2005 17:39:41 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[Date/Time]]></category>
		<category><![CDATA[Parameters]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=18</guid>
		<description><![CDATA[This article demonstrates the use of named-date-range parameters in Crystal Reports.]]></description>
			<content:encoded><![CDATA[<p>Often it&#8217;s useful to be able to use date ranges that are relative to the date the report was run, like &#8216;Month to Date&#8217;, when running a report.  While Crystal Reports&#8217; parameters do not possess this level of flexibility, it is fairly simple to approximate this capability.  This approach uses two parameters and Crystal Reports&#8217; date ranges to do so.</p>
<p><span id="more-18"></span></p>
<h3>Date-Range Parameter</h3>
<p>The first parameter, named &#8216;Date Range&#8217;, will allow an individual to choose one of these values: Yesterday, Last Full Week, Last Full Month, Month To Date or Custom Date Range.  Add these values to the parameter&#8217;s Default Values by clicking the &#8216;Default Values&#8230;&#8217; button.</p>
<h3>Custom Date-Range Parameter</h3>
<p>The second parameter, named &#8216;Custom Date Range&#8217;, will allow an individual to choose specific starting and ending dates.  Ensure that the parameter&#8217;s &#8216;Range Values&#8217; option is chosen.  NOTE: the value &#8216;Custom Date Range&#8217; needs to be chosen from the Date Range parameter, otherwise the value entered in this field is ignored.</p>
<h3>Record Selection Formula</h3>
<p>The record selection will use the selected value from the Date Range parameter to choose between one of Crystal Reports built-in date ranges or the value entered in the Custom Date Range parameter.<br />
<code><br />
//replace {TABLE.FIELD} with the desired value<br />
{TABLE.FIELD} IN (<br />
IF {?Date Range}= "Last Full Month" THEN LastFullMonth<br />
ELSE IF {?Date Range}= "Month To Date" THEN MonthToDate<br />
ELSE IF {?Date Range}="Last Full Week" THEN LastFullWeek<br />
ELSE IF {?Date Range}= "Yesterday" THEN DataDate-1<br />
ELSE {?Custom Date Range}<br />
)<br />
</code></p>
<p>NOTE: DataDate is immutable once a report&#8217;s data has been generated, unlike PrintDate.  Even with saved data, PrintDate will be refreshed each time a report is viewed.  This distinction is important if the report will be deployed in Crystal Enterprise.</p>
<h3>Display the Date Range</h3>
<p>If you would like to display the actual starting and ending dates from the chosen parameter combination on the report, create a formula name &#8216;Date Range&#8217;.  Add the following to the formula&#8217;s text:<br />
<code><br />
select {?Date Range}<br />
case "Yesterday":<br />
CStr(DataDate-1)<br />
case "Last Full Week":<br />
CStr(Minimum(LastFullWeek)) + "-"+ CStr(Maximum(LastFullWeek))<br />
case "Last Full Month":<br />
CStr(Minimum(LastFullMonth)) + "-"+ CStr(Maximum(LastFullMonth))<br />
case "Month To Date":<br />
CStr(Minimum(MonthToDate)) + "-"+ CStr(Maximum(MonthToDate))<br />
case "Custom Date Range":<br />
CStr(Minimum({?Custom Date Range})) + "-"+ CStr(Maximum({?Custom Date Range}))<br />
</code></p>
<h2>Summary</h2>
<p>In addition to making your report more flexible, this technique will make it easier to deploy, manage and schedule your report in Crystal Enterprise.</p>
<h2>Samples</h2>
<p><a href="/wordpress/wp-content/uploads/2006/05/AdvancedParameters.10.zip" title="Advanced Parameter Sample">Crystal Reports 10 &#8211; Advanced Parameter Sample</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2005/11/24/advanced-parameter-usage-in-crystal-reports/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Crystal Reports: Optional-Multi-Select Parameters</title>
		<link>http://cogniza.com/wordpress/2005/11/24/crystal-reports-optional-multi-select-parameters/</link>
		<comments>http://cogniza.com/wordpress/2005/11/24/crystal-reports-optional-multi-select-parameters/#comments</comments>
		<pubDate>Thu, 24 Nov 2005 16:55:56 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[Parameters]]></category>
		<category><![CDATA[Technique]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=29</guid>
		<description><![CDATA[This article demonstrates the use of optional multi-select parameters in Crystal Reports.]]></description>
			<content:encoded><![CDATA[<p>Most report designers are familiar with the parameter&#8217;s &#8216;Allow Multiple Values&#8217; option.  When enabled, this option allows a report&#8217;s user to select one or more values for a parameter at runtime.  The individual running the report could select one or more countries, for example.  Should the individual want to select all countries, he or she would need to add each country individually when the prompt is presented.  If there are a lot of countries, this could be a time-consuming task.  Fortunately, there is a better way.</p>
<p><span id="more-29"></span>To start, edit the multi-select parameter.  You may want to include instructions on how to use the parameter in the Prompting Text&#8211;something like &#8216;Select one or more countries.  Select &#8216;ALL&#8217; for all countries.&#8217;</p>
<p>Next, click the &#8216;Default Values&#8230;&#8217; button.  If the parameter is a string, type &#8216;ALL&#8217; in the &#8216;Select or enter value&#8217; text box, if the parameter is a number type -1.  Click the &#8216;&gt;&#8217; button to add the value to list of default values.</p>
<p>If the parameter is a number click the &#8216;Set Description&#8230;&#8217; button, enter &#8216;ALL&#8217; in the &#8216;Description&#8217; text box, then click &#8216;OK&#8217;.  If you want to hide the numeric values, select &#8216;Description&#8217; from the &#8216;Display&#8217; drop-down list.</p>
<p>In either case, use the up arrow at the top right corner of the &#8216;Default Values/Description&#8217; listbox to ensure that &#8216;ALL&#8217; is at the top of the list.  This will make it easier to select &#8216;ALL&#8217; when the report is run.  Click &#8216;OK&#8217; to exit the &#8216;Set Default Values&#8217; window, then click &#8216;OK&#8217; to exit the &#8216;Edit Parameter Field&#8217; window.</p>
<p>Next, open the report&#8217;s Record Selection Formula Editor.  If the {?Countries} parameter is a string, add the following text:<br />
<code><br />
(If {?Countries}&lt;&gt;'ALL' Then<br />
{Customer.Country} IN {?Countries}<br />
Else<br />
True)<br />
</code></p>
<p>If the {?Countries} parameter is a number,  add the following text:<br />
<code><br />
(If {?Countries}&lt;&gt;-1 Then<br />
{Customer.Country} IN {?Countries}<br />
Else<br />
True)<br />
</code></p>
<p>Essentially, if the parameter&#8217;s value isn&#8217;t ALL, then the filter is applied.  Otherwise, the filter is ignored.</p>
<p>When the report is run, the word &#8216;ALL&#8217; will be displayed first in the list of values for the parameter.  Clicking &#8216;Add&#8217; will set the parameter&#8217;s value to &#8216;ALL&#8217;.</p>
<h2>Summary</h2>
<p>In addition to making your report more flexible, this techniques will make it easier to deploy, manage and schedule your report in Crystal Enterprise.</p>
<h2>Samples</h2>
<p><a title="Advanced Parameter Sample" href="/wordpress/wp-content/AdvancedParameters.10.rpt">Crystal Reports 10 &#8211; Advanced Parameter Sample</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2005/11/24/crystal-reports-optional-multi-select-parameters/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
	</channel>
</rss>

