Jump to content
  • 0

Pass Parameter To Datapage From Separate Table





I was just curious if anyone has done this before or if it can be done.




I have a datapage that is using a predefined criteria of displaying records of  "Next X Days". We want to have the ability to change this number ( X )through an update form.


I noticed you can accept external parameters for this and we have a separate lookup table that will hold the "Days" field and i've created a datapage that the user can access and change the value of days. (Only one record in this table called "Days"). 


Do i need to create a relationship between the 2 tables? Can i even pass a parameter to Next X Days that resides in another table?


Any help would be much appreciated. If I'm not clear then please let me know.


Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi rfarnsworth,


I have an idea, but I am not sure that it is the best :)

In general, the idea is: to create a table, then use Separate Search Page and Results Page into different pages. But in your case, Search Page gets the data from the table and uses autosubmit.


I will try to write steps, but I am not sure that steps will be clear. Please ask, if anything is not clear.

1) Create a Table with only one field - for example, table Days, and the field is Days.

2) Enter the number that will be "X" in the "Next X Days" (for example, "4"). Later you can create a Single Record Update Form to easily edit this value.

3) Create a Submission Form, select the table ("Days") as DataSource.

4) On the Configure Fields step, add three Virtual fields and delete the Days field (as it described in the article).

5) Select Virtual1 field.

5a) Select the Dropdown in the "Form element" field.

5b) Select the Look up table or view in the "Source" field.

5c) Make sure, that Days is selected in the "Table or View" field and days is selected in the "Field for value" field.

6) Select Virtual2 field, go to Advanced tab, select the "On exit Pass field value as parameter" checkbox.

7) Select Virtual3 field, go to Advanced tab, select the "On exit Pass field value as parameter" checkbox.

8) Add the Header and Footer element, enter the following code to the Header:

<div align="center"> <p>Processing...</p></div>

9) Enter the following code to the Footer:

<script type="text/javascript">
if(document.getElementById("caspioform")) {
document.getElementById("caspioform").style.display = 'none';

var TodayDate = new Date();
     var t_month = TodayDate.getMonth() + 1;
     if (t_month<10) {t_month = "0" + t_month;}
     var t_day = TodayDate.getDate();
     if (t_day<10) {t_day = "0" + t_day;}
     var t_year = TodayDate.getFullYear();
     var start_date = t_month + "/" +  t_day + "/" + t_year;
document.getElementById("cbParamVirtual2").value = start_date;

var number_days_field = document.getElementById("cbParamVirtual1");
var number_days = parseInt(number_days_field.options[number_days_field.selectedIndex].value);
var currentDay = TodayDate.getDate();
var nextDay = currentDay + number_days;
var Result = new Date(TodayDate.setDate(nextDay));
     var d_month = Result.getMonth() + 1;
     if (d_month<10) {d_month = "0" + d_month;}
     var d_day = Result.getDate();
     if (d_day<10) {d_day = "0" + d_day;}
     var d_year = Result.getFullYear();
     var end_date = d_month + "/" +  d_day + "/" + d_year;
document.getElementById("cbParamVirtual3").value =  end_date;

setTimeout('document.forms["caspioform"].submit()',1000); } 

10) Finish the Submission form.


11) Edit you predefined Reports DataPage, open the "Select Filtering Fields" step. Select your Date field, click Next.

12) Open the "Configure Filtering Fields" step, select your Date field.

12a) Add New Criteria.

12b) Select the AND radio-button in the "Logical operator between criteria" field.

12c) Select the Criteria1:

select Greater Than or Equal in the "Comparison type" field;

select Date in the "Precision" field;

enter [@Virtual2] to the "Value" field.

12d) Select the Criteria1:

select Less Than or Equal in the "Comparison type" field;

select Date in the "Precision" field;

enter [@Virtual3] to the "Value" field.


I hope, the information helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...