<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Dave's Adventures in Business Intelligence &#187; Prompts</title>
	<atom:link href="http://www.dagira.com/category/design/prompts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dagira.com</link>
	<description>...you are in a twisty maze of passageways, all different...</description>
	<lastBuildDate>Wed, 01 Feb 2012 17:26:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9; </copyright>
		<managingEditor>blogmaster@dagira.com ()</managingEditor>
		<webMaster>blogmaster@dagira.com()</webMaster>
		<category></category>
		<ttl>1440</ttl>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary>...you are in a twisty maze of passageways, all different...</itunes:summary>
		<itunes:author></itunes:author>
		<itunes:category text="Society &amp; Culture"/>
		<itunes:owner>
			<itunes:name></itunes:name>
			<itunes:email>blogmaster@dagira.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://www.dagira.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<image>
			<url>http://www.dagira.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
			<title>Dave's Adventures in Business Intelligence</title>
			<link>http://www.dagira.com</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>Why Can&#8217;t I Validate Prompts?</title>
		<link>http://www.dagira.com/2011/12/21/why-cant-i-validate-prompts/</link>
		<comments>http://www.dagira.com/2011/12/21/why-cant-i-validate-prompts/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 14:23:37 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Prompts]]></category>
		<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=436</guid>
		<description><![CDATA[One of the possible enhancements we have been requesting for years is the ability to validate prompts. (We&#8217;ve also been looking for the ever-so-popular ability to use a formula such as &#8220;Today()&#8221; as a default for a prompt but this is different.) If we had true cascading prompts in Web Intelligence that would eliminate one [...]]]></description>
			<content:encoded><![CDATA[<p>One of the possible enhancements we have been requesting for years is the ability to validate prompts. (We&#8217;ve also been looking for the ever-so-popular ability to use a formula such as &#8220;Today()&#8221; as a default for a prompt but this is different.) If we had true cascading prompts in Web Intelligence that would eliminate one use case for validated prompts but not all. I had someone comment on my blog recently asking about how to validate one prompt selection against another and that started me thinking&#8230; what would something like this look like if we did get it? <span id="more-436"></span></p>
<p>Here&#8217;s a really simple example: I want to ensure that a user enters an end date that is at or beyond the entered start date value. This validation rule is designed to avoid confusion since many databases will not return any rows for a &#8220;backwards&#8221; between operation. (It&#8217;s also a fairly common request, found as far back as 2006 in <a href="http://www.forumtopics.com/busobj/viewtopic.php?t=68674">this topic on BOB</a> and again <a href="http://www.forumtopics.com/busobj/viewtopic.php?t=102181">2008</a>.) I can think of two ways to make this work. First, enforce the prompt entry order so that the user cannot enter the second date before they enter the first date, and give me some way to reference their first entered date in the list of values (LOV) for the second date. By making the second prompt constrained I would force the user to pick from the list of dates, and by referencing the first date in the LOV I can ensure that the only dates that show up do actually occur after the first date. This is technically probably easier to implement, but not the preferred solution.</p>
<p>A second option would be to allow me to create validation rules that fire after all of the prompts have been entered. This is far more flexible as it allows the user to respond to prompts in any order they would like (as it works today) but the validation is done before the query is sent to the database. This could be far harder to implement, primarily because I envision some form of validation language (VB? Crystal?) would be required. Do they invent some new language, or try to implement something that already exists? What if the language is not supported on all platforms? The date example that I have used so far seems fairly trivial: the rule would simply be <code>end_date >= start_date</code> which doesn&#8217;t look that complicated. It looks like an expression rather than a language, but a language is more than that. A full-blown language can have a grammar, reserved words, and all sorts of rules that specify how the various components can be compared.</p>
<p>Does my prompt validation language allow looping structures? I might want to be able to loop through a list of selected items in the case where a prompt offers more than one value. &#8220;Make sure <strong>all</strong> of the end dates are greater than or equal to the latest selected start date&#8221; would be one example. First I have to parse the list of start date values to find the largest entry, and then I have to process the list of end dates to make sure that 100% of them exceed the largest start date.</p>
<p>Doesn&#8217;t look so simple any more, does it? <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Any prompt validation logic would also have to ensure that validation loops don&#8217;t exist. Here I have defined validation rules on each entry that can be true individually but can never be true collectively. This is actually a data entry or coding error but I need to be able to check and react to that.</p>
<ul>
<li>Rule 1 on the start date: Make sure that the start date is greater than the end date.</li>
<li>Rule 2 on the end date: Make sure that the end date is greater than the start date.</li>
</ul>
<p>Can the start date be greater than the end date at the same time the end date is greater than the start date? Probably not. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Since only one of those two rules could ever be true at a given time the query would never run. With three (or even more) prompts the potential complexity for validation loops only gets worse.</p>
<h3>How Might Simple Validation Logic Work?</h3>
<p>As a universe designer I am charged with creating components of code that ultimately will be placed together in some random fashion by a query writer. I have no idea what sort of questions they&#8217;re going to want to answer, nor should I be constrained by that concern. I should be able to make prompt objects that function perfectly fine by themselves, but also in combination with other prompts. The &#8220;start date / end date&#8221; example I started with is very simple. Consider this syntax:</p>
<p><code>some_table.some_date between @prompt('Enter Start Date','D',,mono,validate:&#038;1<&#038;2) and @prompt('Enter End Date','D',,mono,validate:&#038;1&lt;&#038;2)</code></p>
<p>What I have done here is supplement the "free/constrained/primary_key" option with a new feature: validate. The syntax breaks down like this:</p>
<table class="blogtable">
<tr>
<th>Component</th>
<th>Function</th>
</tr>
<tr class="alt">
<td>validate</td>
<td>supplements the current free/constrained/primary_key option and is followed by a simple validation rule</td>
</tr>
<tr>
<td>:</td>
<td>delimiter that denotes validation logic follows</td>
</tr>
<tr class="alt">
<td>&#038;1</td>
<td>references the first argument within the scope of this prompt object</td>
</tr>
<tr>
<td>&#038;2</td>
<td>references the second argument within the scope of this prompt object</td>
</tr>
</table>
<p>The &lt; character is providing a simple validation expression "less than" using a standard mathematical symbol. Other options might include &gt;, &gt;=, &lt;=, ==, and !=. These are all single-value operators that would not support a multi-selection prompt, and the scope of the &amp;1 and &amp;2 doesn't extend beyond this particular prompt object, but it's a start.</p>
<h3>Named Prompt Components</h3>
<p>In order to extend my validation scope beyond a single prompt I need to ensure that I have a unique name that I can reference. <em>(As an aside, this is why class names must be unique within a universe structure. The class name\object name combination must be unique within the universe in order to support the @Select() functionality.)</em> To do this, I might extend my new prompt syntax with the following:</p>
<table class="blogtable">
<tr>
<th>Component</th>
<th>Function</th>
</tr>
<tr>
<td>validate</td>
<td>supplements the current free/constrained/primary_key option and is followed by a more complex validation rule</td>
</tr>
<tr class="alt">
<td>:</td>
<td>delimiter that denotes validation logic follows</td>
</tr>
<tr>
<td>&#038;0</td>
<td>name of this prompt component</td>
</tr>
<tr class="alt">
<td>&#038;1</td>
<td>references the first argument within the scope of this prompt object</td>
</tr>
<tr>
<td>&#038;2</td>
<td>references the second argument within the scope of this prompt object</td>
</tr>
<tr class="alt">
<td>&#038;n:name</td>
<td>references the argument denoted by "name" that occurs somewhere else in the universe</td>
</tr>
</table>
<p>I have introduced two new arguments. The extra argument &amp;0 will allow me to define a unique name for this prompt, and &#038;n:name allows me to reference that value in another prompt. Now I can create two separate prompts that look like this:</p>
<p>Start date check<br />
<code>some_table.some_date >= @prompt('Enter Start Date','D',,mono,validate:&#038;0:start_date&#038;n:start_date<=&#038;n:end_date)</code></p>
<p>End date check<br />
<code>some_table.some_date <= @prompt('Enter End Date','D',,mono,validate:&#038;0:end_date&#038;n:start_date<=&#038;n:end_date)</code></p>
<p>Keeping in mind that it is entirely likely that I would have more than one start date or end date in my universe, I would have to use more verbose prompt names like <code>account_start_date</code> or <code>invoice_range_start_date</code> and so on. In the above example I have two prompts, each has a name, and each has a validation rule. By allowing prompts to have names I can reference the result of one prompt inside of another prompt.</p>
<h3>Event Triggers</h3>
<p>The next challenge could be to determine when the validation logic fires. Does it fire at the end of each prompt selection? I can't really see that working because all of the required values might not yet be defined (selected). Does the validation logic fire when the query is executed? That also might not make sense because if I have a chain of three prompts where 3 depends on 2 and 2 depends on 1 I should be able to trigger the validation as soon as any two values are present. In my simple "start date / end date" example it would be easy to say that the validation logic fires as soon as both values are present. I also haven't addressed how to create the message that is delivered to the user if the prompt validation fails...</p>
<p>Most of the complexity in this process comes from the fact that I'm trying to design a fully generic solution. I don't want to have to write new code for each new prompt screen that I might design, I want to create reusable logic and syntax that works across the entire universe. I think it's easy to see why this is such a complex question, and perhaps indicates why we don't have anything like it so far within the universe.</p>
<p>But being able to set up a date value like "today" as a dynamic default value... that should be easier to implement. I hope we see that... and soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2011/12/21/why-cant-i-validate-prompts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Too Many Objects? Too Many Rows? Try Prompting For Level of Detail</title>
		<link>http://www.dagira.com/2010/08/04/too-many-objects-too-many-rows-try-prompting-for-level-of-detail/</link>
		<comments>http://www.dagira.com/2010/08/04/too-many-objects-too-many-rows-try-prompting-for-level-of-detail/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 23:06:39 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Prompts]]></category>
		<category><![CDATA[Universe Design]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=308</guid>
		<description><![CDATA[A while back I was on a project where the users wanted to set up reports that initially displayed about six different dimension objects and a bunch of measures. They also wanted to have the flexibility of dragging a different set of dimension objects on the report and either adding to or replacing an existing [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I was on a project where the users wanted to set up reports that initially displayed about six different dimension objects and a bunch of measures. They also wanted to have the flexibility of dragging a different set of dimension objects on the report and either adding to or replacing an existing dimension. The idea was good. The amount of data brought back was a problem. I was able to fix that with some interesting prompt objects in the universe.</p>
<h3>The Problem Definition</h3>
<p>For the example I will present in this post I will once again use my version of Island Resorts Marketing universe which I have converted to Oracle. I will create a report that initially shows the Resort and (for simplicity) a single measure (Revenue). The report will be designed to let the user drag on additional details like Service Line and Service. But I will design my objects in such a way that if the user doesn&#8217;t want to see the information at that level of detail they don&#8217;t incur the overhead (row count) simply because the object is present in the query. In order to accomplish this, I will prompt the user with a list that includes the tokens &#8216;Resort&#8217;, &#8216;Service Line&#8217;, and &#8216;Service.&#8217; The user will select the lowest level of detail they expect to use on the report. In this particular example the selections are hierarchical, meaning that selecting &#8216;Service Line&#8217; implies that the Resort data will also be present. There is another option &#8216;None&#8217; that can be selected if they want to deactivate the entire list.</p>
<p><em>Note that XI 3.1 offers a new feature called Query Stripping (in service pack 3) that works for BW and other OLAP queries and does this process automatically. It is not (yet) available for relational databases.</em> <span id="more-308"></span></p>
<p>My steps are:</p>
<ul>
<li>Create a derived table to provide values for my prompt</li>
<li>Create a custom LOV query to display the prompt values in the desired order</li>
<li>Create a prompt object that allows a user to select the desired level of detail</li>
<li>Create custom Level of Detail (LOD) versions of the impacted dimension objects</li>
<li>Build my report</li>
</ul>
<h3>Creating the Level of Detail Prompt</h3>
<p>First I have to create some data in my universe to feed my list of values (LOV) query. I have detailed this technique before. It&#8217;s quite simple to use a derived table and select against the DUAL table (in the case of Oracle) or equivalent and build any sort of list. Something like this will give me a list of values for the Resort level of detail (LOD) prompt.</p>
<pre>select 1 as LOD_Order, 'Resort'  as LOD_Resort from dual
union
select 2, 'Service Line' from dual
union
select 3, 'Service' from dual
union
select 4, 'None' from dual</pre>
<p>I have defined two columns for my derived table. The first is called LOD_Order and it will be used to order the prompt items in the way I expect to see them. The second column is the value that will populate my LOV. After creating this derived table I checked to see what the values were, and they came up as expected.</p>
<p><img src="/tips/level_of_detail/derived_table.png" width="224" height="198" border="0" alt="level of detail table rows" title="Level of Detail derived table rows" /></p>
<h3>Creating the Custom LOV Query</h3>
<p>The next step is to build the objects I need to create the list of values (LOV) that will appear in my prompt definition. I will create a class called &#8220;LOV&#8221; that includes objects for both the LOD_ORDER and the LOD_RESORT columns. Eventually these objects will be hidden, but I will need them to be visible in order to create my custom LOV query. The LOV will be built on the Resort LOD object, and initially it won&#8217;t look too special. It includes only the selected object. The trick is that I want to see the values in a specific order; that&#8217;s why I added the &#8220;order&#8221; column to my derived table. In order to create a sort on this object, I need to click on the Manage Sorts button shown here.</p>
<p><img src="/tips/level_of_detail/lov_query.png" width="542" height="163" border="0" alt="query panel screen shot" title="Sort Manager for the query panel definition of the custom LOV object" /></p>
<p>That button is only active if my database supports an order by clause that includes objects that do not appear in the select clause. If that button does <strong>not</strong> appear and I know that technique will work, I can update my designer parameter file as detailed in an earlier post titled, <a href="http://www.dagira.com/2010/03/04/sort_by_nono-very-confusing/">&#8220;SORT_BY_NO=NO? Very Confusing…&#8221;</a> which shows how to accomplish that. Clicking that button allows me to define a custom sort based on the LOD Order column.</p>
<p><img src="/tips/level_of_detail/lov_query_order.png" width="561" height="405" border="0" alt="Screen shot of Designer LOV screen" title="Adding a custom order object to my LOV query definition" /></p>
<p>When I run the query I see the rows in the order I expect.</p>
<p><img src="/tips/level_of_detail/lov_query_results.png" width="351" height="378" border="0" alt="Screen shot of Designer LOV results" title="Results of my custom LOV in the desired order" /></p>
<h3>Defining the Prompt</h3>
<p>I am going to reuse the prompt logic in multiple objects (Resort, Service Line and Service) so I am going to define it once and reference it using the @Select() function. Here&#8217;s the prompt:</p>
<pre>@Prompt('Please select desired Level of Detail','A','LOV\Resort LOD',mono,constrained)</pre>
<p>This is fairly standard syntax. The prompt text is defined, and the type of response is &#8216;A&#8217; for character data. The LOV definition points to the custom query I created in the last step. I only want to allow a user to select a single value, and because the data only works if it comes in as I expect I am constraining the user. They <strong>have</strong> to pick from my list in order to proceed.</p>
<h3>Building the Level of Detail Objects</h3>
<p>I will be able to save some effort by reusing the prompt definition using the @Select() function. Here&#8217;s what my new Resort object looks like:</p>
<pre>case @Select(Level of Detail\LOD Prompt)
when 'None' then 'Resort N/A'
else RESORT.resort
end</pre>
<p>Resort is the top of the list. That means if I pick Resort, Service Line, or Service, I want to see the resort values populated. This means I can take a shortcut. If the user selects &#8216;None&#8217; then I won&#8217;t show the resort values. If they pick anything else, I will.</p>
<p>The rest of my objects look very similar.</p>
<p>Service Line</p>
<pre>case @Select(Level of Detail\LOD Prompt)
when 'None' then 'Service Line N/A'
when 'Resort' then 'Service Line N/A'
else SERVICE_LINE.service_line
end</pre>
<p>Service</p>
<pre>case @Select(Level of Detail\LOD Prompt)
when 'None' then 'Service N/A'
when 'Resort' then 'Service N/A'
when 'Service Line' then 'Service N/A'
else SERVICE.service
end</pre>
<p>What I did was add a line of code to each of my objects, since each was at a lower level of detail. Note that I could have taken the opposite approach and defined my Service object like this:</p>
<pre>case @Select(Level of Detail\LOD Prompt)
when 'Service' then SERVICE.service
else 'Service N/A'
end</pre>
<h3>Building the Report</h3>
<p>I can now create a very simple report that includes all three of my new LOD objects and the Revenue. When I run the report at the Service level of detail it will show all of the detailed data, just as it would have before I created these custom objects. The results from Island Resorts end up being 27 rows of data.</p>
<p><img src="/tips/level_of_detail/report_detail.png" width="433" height="619" border="0" alt="Web Intelligence report at the lowest level of detail" title="Web Intelligence report at the lowest level of detail" /></p>
<p>If I rerun the exact same report at the Resort level of detail I get three rows. </p>
<p><img src="/tips/level_of_detail/report_summary.png" width="433" height="91" border="0" alt="Web Intelligence report at the resort level of detail" title="Web Intelligence report at the resort level of detail" /></p>
<p>The objects that I dropped from my level of detail are showing &#8220;N/A&#8221; values in the block. The prompt shows my four choices in the desired order because of the customizations I did for the LOV earlier.</p>
<p><img src="/tips/level_of_detail/report_prompt.png" width="511" height="444" border="0" alt="Report prompt screen" title="Web Intelligence report prompt screen" /></p>
<p>What is the true impact here? What have I really accomplished?</p>
<h3>Impact Analysis</h3>
<p>Sample databases like Island Resorts are great for fooling around because they&#8217;re small. They&#8217;re not so great for demonstrating techniques like this because the true impact is hard to determine. I went from 27 rows down to 3, not really a big deal, right? On a larger database with more combinations of dimension values, the impact could be far more significant. I might drop from 50,000 rows down to several hundred. And the beauty of it is that if the user doesn&#8217;t need the level of detail, they don&#8217;t pay the penalty of downloading 50,000 rows only to roll it up (via projection) on the report. If they later drag on one of the suppressed objects and see the &#8220;N/A&#8221; result, all the user has to do is refresh the report and select the new level of detail to get more rows.</p>
<p>My sample report screen shots included all of the objects at the same time in order to show what was really happening. When I used this technique for a real report, I only included objects that I wanted to see from the beginning. The other LOD objects were listed in the available objects. </p>
<h3>Alternate Solution</h3>
<p>The solution I outlined here works as desired if there is a rigorous hierarchy and the user is just selecting the lowest level of detail desired on the report. What I actually had to implement was a bit more complex and I will provide a sketch of the solution here. The actual requirement was based on different combinations of dimension objects. A matrix of choices might look like this:</p>
<pre>Resort (by itself)
Service Line (also by itself)
Service
Resort + Service Line
Resort + Service
Service Line + Service
Resort + Service Line + Service
None</pre>
<p>Instead of the simple case statement objects I showed earlier, I had to use a pattern matching function and look for the string &#8220;Resort&#8221; anywhere in the prompt result. If the user picked anything that included the Resort as an option, then the Resort object would return a value. Ultimately I created prompt &#8220;bit&#8221; objects in order to simplify the logic.</p>
<h3>Conclusion</h3>
<p>I thought this was an interesting technique to share at this point, what with the recent release of SP3 with the Query Stripping feature for cube data. It worked well for the project. In some cases this strategy allowed us to reduce the number of rows by an order of magnitude (10,000s of rows down to 1,000s or even hundreds) while retaining a large number of objects in the report. The biggest drawback of this solution is that my SQL code will still hit the requested tables, even if I am not really requesting any data. Going back to my earlier example, a true query stripping process would eliminate the resort, service line, and service tables if I selected &#8216;None&#8217; from the prompt. In my &#8220;level of detail&#8221; solution all of those tables are still present and therefore have an impact on the query performance. </p>
<p>The issue I was trying to solve in this case was related to the number of rows downloaded to the report. The queries ran fast enough that the query performance was not as big of a concern. It was my goal to provide a way to reduce the row counts without losing the flexibility to add more dimension objects to my report on the fly. This technique accomplished that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2010/08/04/too-many-objects-too-many-rows-try-prompting-for-level-of-detail/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Designer XI 3 New Feature: Extended Prompt Syntax</title>
		<link>http://www.dagira.com/2008/11/01/designer-xi-3-new-feature-extended-prompt-syntax/</link>
		<comments>http://www.dagira.com/2008/11/01/designer-xi-3-new-feature-extended-prompt-syntax/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 12:44:36 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[2008 GBN - Dallas]]></category>
		<category><![CDATA[Prompts]]></category>
		<category><![CDATA[Universe Design]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=126</guid>
		<description><![CDATA[The @Prompt() function has been around for a very long time. There have been subtle changes made to it over the years to support some of the new Web Intelligence extended options but they were not always documented. I don&#8217;t know about you, but I find using undocumented features a bit daunting.  

Documentation is [...]]]></description>
			<content:encoded><![CDATA[<p>The @Prompt() function has been around for a very long time. There have been subtle changes made to it over the years to support some of the new Web Intelligence extended options but they were not always documented. I don&#8217;t know about you, but I find using undocumented features a bit daunting. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-126"></span><br />
<h3>Documentation is Good</h3>
<p>Designer 3.0 is the first time that I have been able to find the extended prompt syntax documented. It even mentions the <code>primary_key</code> attribute which was apparently present (and usable) in XI R2. This feature allows me to create prompts in the Universe Designer that will still <a href="http://www.dagira.com/2007/10/26/index-awareness-part-i-the-basics/">leverage Index Awareness</a>, assuming I have set that up.</p>
<p>Here is the prompt syntax shown in the XI 3 Designer manual:</p>
<blockquote><p>@Prompt(&#8217;message&#8217;,'type&#8217;,[lov],mono/multi,free/constrained/primary_key,per<br />
sistent/not_persistent, [{'default value':'default key'[,'default value':'default<br />
key',...]})</p></blockquote>
<p>I&#8217;ve <a href="http://www.dagira.com/2008/07/15/how-can-i-make-today-my-default-prompt-value/">covered the prompt syntax before</a> so I won&#8217;t review everything. But the new features are interesting. The new feature <code>primary_key</code> was used in my &#8220;Ninja&#8221; presentation from last year with a disclaimer about it being an &#8220;undocumented feature&#8221; and the note of being a bit risky to use as a result. Now it is not only documented but there is a modifier for the default value option as well.</p>
<h3>Using Index Aware Objects With Prompts</h3>
<p>Recall that index awareness is designed to create more efficient SQL. Instead of </p>
<p><code>RESORT.RESORT = 'Bahamas Beach'</code> </p>
<p>I would see </p>
<p><code>RESORT.RESORT_ID = 2</code></p>
<p>With the new prompt parameter I can specify the default value in a <code>value:key</code> pair, like this:</p>
<p><code>RESORT.RESORT_ID = @Prompt('Please select Resort', 'A', 'Resort\Resort', mono, primary_key, not_persistent,{'Bahamas Beach':'2'})</code></p>
<p>The option <code>mono</code> of course means I will only select one value. That is not new. The option <code>primary_key</code> tells the SQL generator that this object is index aware, and that I want the key to be used rather than the value. The option <code>not_persistent</code> is used to tell the SQL generator that I don&#8217;t want to retain the last user selected value. And finally, the string <code>'Bahamas Beach':'2'</code> is used to show that the default value shown to the user is Bahamas Beach but the default value provided to the prompt is the key value 2 instead. </p>
<p>Special note: if I want to use a default value, then I have to specify not_persistent. If I don&#8217;t, then the default value is only good the first time the query is refreshed. From that point forward the last user selection will be used instead.</p>
<h3>What About Those {}?</h3>
<p>A reader with extremely good attention to detail will notice that the syntax I posted above does not match what was shown in the user manual. In order to get the object to parse I had to follow the exact syntax shown in the function help in Designer rather than what is in the documentation. What&#8217;s different? The code I used has curly braces { } around the value:key pair at the end. The curly braces are also used when providing a hard-coded list of values, so I guess that&#8217;s not too surprising.</p>
<h3>Conclusion</h3>
<p>The primary_key and default:key additions to the @prompt() syntax are quite powerful, and should be well-received by universe designers. I feel much more comfortable using something that is documented (even with slight errors) than using a feature that isn&#8217;t detailed in the documentation or help files anywhere. The concept of index awareness just became a lot more attractive with this addition.</p>
<p><em>This feature was one of several mentioned in my Designer Essentials presentation delivered at the 2008 GBN conference. This feature was covered on page 9.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2008/11/01/designer-xi-3-new-feature-extended-prompt-syntax/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Using a &#8220;Magic Date&#8221; Value in Prompts</title>
		<link>http://www.dagira.com/2008/07/21/using-a-magic-date-value-in-prompts/</link>
		<comments>http://www.dagira.com/2008/07/21/using-a-magic-date-value-in-prompts/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 12:21:45 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Prompts]]></category>
		<category><![CDATA[Universe Design]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=98</guid>
		<description><![CDATA[In the first post on designing universe prompts I talked about the idea of having a default date value present in a prompt. In case you don&#8217;t want to read the entire post, here is the executive summary:
You can&#8217;t do it, sorry.
At the end of that post I mentioned something called a &#8220;magic date&#8221; that [...]]]></description>
			<content:encoded><![CDATA[<p>In the first post on designing universe prompts I talked about the idea of having a default date value present in a prompt. In case you don&#8217;t want to read <a href="http://www.dagira.com/2008/07/15/how-can-i-make-today-my-default-prompt-value/">the entire post</a>, here is the executive summary:</p>
<blockquote><p>You can&#8217;t do it, sorry.</p></blockquote>
<p>At the end of that post I mentioned something called a &#8220;magic date&#8221; that I frequently use in my universes to get past this limitation. That&#8217;s my subject for today.</p>
<h3>Problem Definition</h3>
<p>I have a date prompt in my universe. I would like to be able to provide a default value of today&#8217;s date. This would allow my users to click-n-go on the report without having to update the date value each time. It is also essential for scheduled reports, which is something I didn&#8217;t really touch on last time. When I schedule a report, I have to provide values for every prompt. I have a long <a href="http://www.dagira.com/category/design/dynamic-dates/">series of posts on how to create some dynamic date objects</a> that can be used for scheduling, but those were not prompts.</p>
<p>In a nutshell: I need a way to accept a prompt value and convert it to today&#8217;s date for user convenience and for scheduling. Can I make that happen?</p>
<p><span id="more-98"></span><br />
<h3>Defining the Magic Date</h3>
<p>First, a quick recap. When I set up a prompt in the universe, one of the required arguments is the datatype. A &#8216;D&#8217; designates a prompt as a date value. That means that anything entered in that date prompt field has to pass the basic validation that will be done by the application. I can&#8217;t put the word &#8220;Today&#8221; in this prompt, as &#8220;Today&#8221; is not anywhere close to being a valid date. That&#8217;s where the concept of a &#8220;magic date&#8221; comes from.</p>
<p>What I do is define a specific date as the magic date. Quite frequently I will use something like January 1, 1900, as it is highly unlikely that any of my records will include that date as a valid entry. That is the first important point about this concept: I must pick a date that will never appear as part of my normal data. That&#8217;s my magic date.</p>
<h3>Defining the Prompt</h3>
<p>Once I have selected my magic date I can now create my prompt using the basic five parameters. It might look something like this:</p>
<p><code>@prompt('Enter shipping date','D',,mono,free)</code></p>
<p>In this prompt I am asking for a shipping date, I am expecting a valid date value, there is no list of values, and the user will enter only one value. There&#8217;s nothing magical about that prompt. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The magic comes in when I create the condition object that includes that prompt. Imagine that I have a report that is designed to show orders that shipped today. Suppose that my magic date is January 1, 1900, as I mentioned before. Here&#8217;s what the code looks like (I will explain it after):</p>
<p><code>orders.ship_date = case when @prompt('Enter shipping date','D',,mono,free) = '1900-01-01' then DATE else @prompt('Enter shipping date','D',,mono,free) end</code></p>
<p>I&#8217;ve used Teradata syntax here but the concept applies to any database. (Teradata offers several options to return the date for &#8220;today&#8221; and DATE is the example I selected here.) One of two things will happen in this condition. A user will either enter a standard date, or they will enter the magic date. If they enter a standard date the code resolves to this:</p>
<p><code>orders.ship_date = case when '2008-07-21' = '1900-01-01' then DATE else '2008-07-21' end</code></p>
<p>In this case the case logic eliminates the first option and takes the second option and the net logic becomes:</p>
<p><code>orders.ship_date = '2008-07-21'</code></p>
<p>What if the user enters the magic date? Using the same process the code first resolves to this:</p>
<p><code>orders.ship_date = case when '1900-01-01' = '1900-01-01' then DATE else '1900-01-01' end</code></p>
<p>Which is logically the same as this:</p>
<p><code>orders.ship_date = DATE</code></p>
<p>So, there I have it. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  By applying a case statement to the right-hand side of this database condition, I can react in two different ways. In one case I take the user parameter value exactly as entered. In the other case I convert a special date (magic date) into the system current date instead. Now if one of my users schedules a report with this prompt, all they have to do is enter 1900-01-01 as their date parameter and each time their scheduled report is executed the parameter value will change.</p>
<h3>Conclusion</h3>
<p>With some creative date logic I can convert the magic date to today, yesterday, end of this week, end of last week, end of the month&#8230; just about anything else that I&#8217;ve already covered in my dynamic date series of posts. I can use the concept of a &#8220;magic number&#8221; for numeric prompts and a &#8220;magic string&#8221; for text prompts as well, although those are generally not used as frequently.</p>
<p>Would it be nice if I could use a variable in a prompt to avoid this sort of extra work? Sure, I think it would. I listed a bunch of different prompt enhancements that I have been looking for, in some cases for years, in my last post on prompts. One of those enhancements that I (and a gazillion other folks) would like to see is proper cascading prompts. I plan to have that as my next post on prompts. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2008/07/21/using-a-magic-date-value-in-prompts/feed/</wfw:commentRss>
		<slash:comments>69</slash:comments>
		</item>
		<item>
		<title>How Can I Make &#8220;Today&#8221; My Default Prompt Value?</title>
		<link>http://www.dagira.com/2008/07/15/how-can-i-make-today-my-default-prompt-value/</link>
		<comments>http://www.dagira.com/2008/07/15/how-can-i-make-today-my-default-prompt-value/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 04:18:40 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Prompts]]></category>
		<category><![CDATA[Universe Design]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=97</guid>
		<description><![CDATA[I have seen this question come up frequently on BOB lately. And if the question keeps coming up, it becomes an easy idea for a blog post. That way, once I document a concept or a solution I have somewhere consistent to link to. The short answer to the question, unfortunately, is no. But let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen this question come up frequently on BOB lately. And if the question keeps coming up, it becomes an easy idea for a blog post. That way, once I document a concept or a solution I have somewhere consistent to link to. The short answer to the question, unfortunately, is no. But let&#8217;s investigate and explain a bit further than that, shall we?</p>
<p><span id="more-97"></span><br />
<h3>Problem Description</h3>
<p>I have a report. The report has a date prompt. I want the date prompt to have a default value (partially possible) and I want the default value to be &#8220;today&#8221; instead of a standard date. The question is quite reasonable, in my opinion. Prompt handling has been one of the weakest points of the Business Objects tools for a long, looonnng time. A prompt can be created on a report or in the universe. If the prompt is defined in the universe there is a standard syntax. So I will start with a brief review of that syntax and move on from there.</p>
<h3>@Prompt() Me One More Time&#8230;</h3>
<p>The standard prompt syntax has five arguments. The first two are generally considered required while the remaining three are optional. Here is the syntax:</p>
<pre>@prompt('Enter prompt text here','A',LOV Source,mono/multi,free/constrained)</pre>
<p>I&#8217;ll break down each of those five parameters next. First, the prompt text. The first argument is required and is the most obvious&#8230; it contains the text that the user will react to. It&#8217;s a good idea to let the user know what&#8217;s going on and to provide some clue as to how the prompt will operate. For example, if you are using a prompt in an equality test, you should inform the user that they can only select a single value. If you are using the prompt in a list, then let them know they can select one or more values.</p>
<p>The next argument has three options: A, N, or D. These match with the datatype expected from the prompt. The &#8216;A&#8217; represents alphanumeric data, and any data entered is accepted as it was entered. Using an &#8216;N&#8217; denotes a numeric prompt and only valid numeric values are accepted. Finally, a &#8216;D&#8217; represents a date prompt. With this type of prompt Webi will include a spiffy calendar that a user can use to select their entry. This is available even if the LOV has been turned off.</p>
<p>The third parameter is a reference to a potential list of values for the prompt. There are two possible options: either a hard-coded list, or an object from the universe. If I wanted to make a hard coded list with the values &#8220;Yes&#8221; and &#8220;No&#8221; on it here is the syntax:</p>
<pre>{'Yes','No'}</pre>
<p>The values are surrounded with curly braces { } and entered as a comma-separated list. Character data is in quotes. Simple enough, yes? no? <img src='http://www.dagira.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>If I wanted to use an existing object in the universe for the list of values I would enter that choice without the curly braces and in the format <code>'Class Name\Object Name'</code> instead. One common designer mistake is attempting to use a table.column syntax here. The table.column is of course the eventual source for the list of values, but the LOV query is defined as part of an object definition. That&#8217;s why you enter an object here rather than a table column.</p>
<p>The last two parameters are optional, but even if you leave them out you have to include the commas for the prompt syntax. In other words, this is valid:</p>
<pre>@Prompt('Do you like BOB?','A',{'Yes','Yes, of course'},,)</pre>
<p>Even though the values are missing the commas remain. What do the values do if you include them? The fourth parameter allows you to specify whether the prompt is a multi-select option or not. The value <code>mono</code> (no quotes here) says the prompt is restricted to a single value. The value <code>multi</code> (again, no quotes) allows for multiple values to be selected. The fifth parameter determines whether the user can type the prompt response or if they are required to pick from the list of values. The value <code>free</code> does the former, and the value <code>constrained</code> requires the LOV selection. Here&#8217;s a hint: don&#8217;t make a prompt constrained without providing a valid list of values source. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>So those are the five basic arguments for the @Prompt() function. Most of you will have noticed that none of them have anything to do with providing a default value. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' /> </p>
<h3>@Prompt() Extended Syntax for Web Intelligence</h3>
<p>We got some new prompt options starting with Web Intelligence 6.x. One of the options a report writer could use was whether or not the last prompt value entered was the default for the next report run or not. Another option was whether the prompt had a default value or not. And finally, report prompts could appear in a user-specified order rather than in alphabetical order as before. But all of these options were <strong>report specific</strong> and not supported in Universe Designer. </p>
<p>Here&#8217;s what the extended prompt syntax looks like:</p>
<p><code>@Prompt('Enter value(s) for Something:','A','Class\Something',Multi,Free,Persistent,{'Default Option'},User:0)</code></p>
<p>I&#8217;ve already covered the first five parameters so now I&#8217;ll detail the last three. The sixth parameter has the value <code>Persistent</code> or <code>Not_Persistent</code>. The default value is to retain the last value entered (Persistent). This is also the legacy behavior; previous versions of the reporting tools only worked in a persistent manner.</p>
<p>The seventh parameter has a syntax that looks a bit like the hard-coded LOV from earlier with the curly braces. This is where a default value for the prompt can be stored. And finally, the last parameter determines the order of the prompt, starting with zero (0) as the first prompt and incrementing from there.</p>
<p>To reiterate something I stated earlier: <strong>These are report options only.</strong> These parameters can be entered into a prompt object definition in the universe, but they are unlikely to parse because of the extended syntax. In order to test this syntax I would have to export my universe and test in a Web Intelligence query.</p>
<h3>What About That Default Value?</h3>
<p>Extended prompt parameter number six: a default value. That brings me back to the original subject for this post, doesn&#8217;t it? I wanted to have a value like &#8220;sysdate&#8221; or a formula of some kind like CurrentDate() plugged into that parameter. Unfortunately, it doesn&#8217;t work. Any value entered for that parameter is treated as data, and no formulas or calculations will be calculated. So anything like sysdate or getdate() or CurrentDate() is going to fail. </p>
<p>The next trick is to try to reference an object, and store the formula as the object definition instead. Unfortunately, again, it fails. The object name becomes the default value for the prompt which is generally not the intended result.</p>
<h3>Conclusion</h3>
<p>What it boils down to, as I see it, is this: you can&#8217;t do it. There is no way to create a prompt syntax that will substitute in a value like &#8220;today&#8217;s date&#8221; for a prompt default value. It would be nice, but it doesn&#8217;t work.</p>
<p>However, I do have a work-around that I&#8217;ve used for many years. I create a &#8220;magic date&#8221; and some creative logic within the prompt to do the substitution <strong>after</strong> the user has already responded to the prompt. That&#8217;s the subject for the next post in this series. Stay tuned for details. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> </p>
<h3>Things I really REALLY wish prompts could do&#8230;</h3>
<ol>
<li>Set a default with a variable. It&#8217;s the subject of this post, need I say more?</li>
<li>Be optional! With XI 3.0 a report writer can create optional prompts now, but we still can&#8217;t do them in Designer. Boo.</li>
<li>Do cascading prompts effectively. This has been on my wish list for-EVER. I have another post about cascading prompts coming up soon so I&#8217;ll save the majority of my whining until then.</li>
<li>We have free and constrained, I want a third option: validated. This would be the best of both worlds. A user would be &#8220;free&#8221; to enter the value if they wanted to, but it would be validated against the LOV provided in the universe. Today I have to allow the user to shoot themself in the foot by typing the wrong value, or I have to force them to use the LOV.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2008/07/15/how-can-i-make-today-my-default-prompt-value/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
	</channel>
</rss>

