The Result Data Newsletter   
Volume 909 - September 2009   
© Copyright 2009 Result Data Consulting, Ltd.  614-505-0770   www.resultdata.com   

    Result Data Home Page  |  Newsletter Archive  |  Upcoming Events  |  Classes &Workshops  |  Request Information
Upcoming Events: Microsoft SQL Server User's Group ,    Hands on Dashboard Analysis Event   
Mid-Ohio Business Objects User's Group

Return to Newsletter Contents...

 

Choices, Choices, Choices?

By Aaron Zechman, Senior Consultant, BOCP – CR, BOCP – WebI. MCSE

“There are two primary choices in life: to accept conditions as they exist, or accept the responsibilities for changing them.” – Denis Waitley
The choices that we allow our users to make inside WebIntelligence happen through prompting inside the query filter pane.  Inside this query filter pane, we sometimes want to display the choices of the user on the report itself.  To do this we use the UserResponse function; however, there are some problems with using this at times with date fields and now being able to have optional prompts.  First, we will go over the UserResponse function and then learn how to handle some of the other situations that may occur during report writing.
The UserResponse displays a choice or choices that a user has chosen for a prompt.  The syntax for the UserResponse is:
string UserResponse(object data_provider; string prompt_text; Index)
Now at times the data_provider is going to be optional and not used because a lot of times we only have one query that we are dealing with in our WebIntelligence document.  If we have more than one then this may come into play.  We are going to pretend we are only dealing with one query.
To get a user’s answer to display on the report, the filter pane has a lot to do with it.  Let us say we took an object called “name” and made it a prompt.  It would then say “Enter a user name:” when this is done.  This prompting text is important when using the UserResponse function.  We could then put an empty cell on our report and in the Formula Toolbar type the following:
=UserResponse(“Enter a user name:”)
This has to be exactly how it is in the filter pane in capitalization, spacing, etc. otherwise it will not work.  This should display the name of the person that the user selected.
Now what happens if it is not just one name that you choose, so instead of equality you use the “in list” operator?  It will display the names as “Name1; Name2; Name3”.  Now if colons between your choices is acceptable to your organization your job is finished; however, to most people this is not acceptable.  We now would have to combine functions in order to remove the semicolons and bringing it to a more display friendly format.  We need to use the replace function as well.
=Replace(UserResponse(“Enter a user name:”);”;”;”, “)
Now this is a lot of semicolons in a row so you need to be careful; however, the report should now show all items chosen separated by a comma and a space.
This is not the only time we have problems though.  What if we are working with a date that our user enters?  So somewhere we have “Enter a date:” as a prompting text.  If we use the same user response we are going to get a date back along with a time on our report.
MM/DD/YYYY HH:MM:SS
A lot of times we really don’t care about the time being displayed on the report and all we want is the date to display.  To get around this we would need to use the ToDate and FormatDate functions as well.  It should look something like the following:
=FormatDate(ToDate(UserResponse(“Enter a date:”); “M/d/yyyy hh:mm:ss A”); “MM/dd/yyyy”)
Yes, I know that’s a lot to get the response display as just a date without time but this will help you out from an end user acceptance perspective.
Lastly, we need to go over how to display an optional parameter of a report.  This ultimately removes this from the WHERE clause and brings back all values if no value is selected.
IF UserResponse(“Enter a date:”) = “” then
  “ALL”
Else
  UserResponse(“Enter a date:”)
So now you have several different uses of the UserResponse function inside WebIntelligence.  Please choose wisely which you use.

Go to Top  |  Return to Newsletter Contents

The Result Data Newsletter is published approximately once a month to share the latest information on business intelligence, data management and CRM. There should be a link below to allow you to change or remove yourself from our list. We take your requests very seriously. If you have any difficulty please contact us at 614-505-0770 and we will make sure that your request is handled properly. This is not intended to be an unsolicited message and you can reach us in person if needed.

© Copyright 2009 Result Data Consulting, Ltd. - All Rights Reserved
All trademarks and copyrights are the property of their respective owners. This information is provided without warranty.
Announcements
Free Whitepaper - 17 Rules of the Road for CRM
Will your system for managing sales leads be ready to handle the increase in customer and prospect requests that will surely come as the economy begins to rebound? Download the free report "17 Rules of the Road for Customer Relationship Management".
More Information...
Seeing is Believing - Download Now
Result Data invites you to download QlikView 9—not a trial product, but a full version of this powerful analysis platform. With QlikView 9, you can analyze your data, from business expenses and budgets to deep product research.
More Information...
Microsoft SQL Server User Group
Join the Microsoft SQL Server Users Group to learn, share and discover information about SQL Server and related Microsoft software. The meetings are packed with information and advice and you can interact with specialists and other SQL Server users.
More Information...