Here is the situation…
Let’s say I’ve built a report for our bike distributor, crazybikes.com, for users to learn how much specific customers have spent on each product class (Bicycles, Accessories, Athletic Wear, etc) at this point in the month.
My selection of records is based on the Customer Number, the Month-to-Date (MTD) Sales Dollars, and the Product Class. At runtime, I want the user to input the Customer Number and an amount for MTD Sales Dollars. But for the Product Class, I want it to be hard-coded in the selection criteria as either 100 (bicycles) or 200 (accessories).
In order to get the correct information in the report I’ll need to repeat the selection for the Customer Number and Month to Date Sales for each Product Class I want. So, the logic of my selection criteria would be the following:
…which would result in the following the report prompt page:
As you can see, the user will then be forced to enter the selections for Customer Number and MTD Sales Dollars multiple times, even though the values will be the same. This might be tedious to the user and it may also confuse them. So, I suggest making a few minor changes in the HTML of the report prompt page (Rxxxxxs.html) to avoid this problem. Where I’ll hide the duplicate prompts, but also pass the values entered from the previous prompts for Customer Number and MTD Sales Dollars to them.
Step 1:
Insert the JavaScript “getvalue” function, which is displayed below. You can add it directly before the </head>
tag, which is towards the top of the HTML page.
<script language="JavaScript"> function getvalue(){ document.FORM_R12050.R003.value=document.FORM_R12050.R001.value; document.FORM_R12050.R004.value=document.FORM_R12050.R002.value; } </script>
NOTE: You will have to make changes to this JavaScript to fit your application. Where you see R12050 , which is my report number, you’ll have to replace that with yours. Secondly, our naming convention for the runtime values is; R001 for first runtime field, R002 for the second, R003 for the third, R004 for the fourth, and so on. So, in my JavaScript I set R003 (my duplicate Customer Number prompt) to retrieve the value entered into R001 (First Customer Number prompt). And I did the same for R004 (duplicate MTD Sales Dollars prompt), where it retrieves the value entered into R002 (First MTD Sales Dollars prompt)
Step 2:
Change the below line to include onSubmit=”getvalue();”
From:
<form action="DATADICTIONARY.R12050s" method="post" name="FORM_R12050">
to:
<form onsubmit="getvalue();" action="DATADICTIONARY.R12050s" method="post" name="FORM_R12050">
Step 3:
In this step, you need to hide the duplicate selection prompts from the page but still make them available to accept the values being passed. This can be easily done through the WYSIWYG m-Painter by right clicking on the appropriate rows to hide and select “Hide Row”.
Step 4:
And that’s it! When you run your report the prompt page will look like this: