ISlp59lp Posted December 16, 2013 Report Share Posted December 16, 2013 I'm using the Search and Report Wizard. I have a table(tbl_game) with one column containing a datetime field. (ex: 09/25/2009 18:00:00) I have created the search form with a dropdown that allows user to select specific year (ex: 2009) Now, how do I generate the search such that the report yields only those records with the selected year (ex: only 2009 games)? Anthonyjulk 1 Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted December 17, 2013 Report Share Posted December 17, 2013 In the search page when you select a date field then you can choose one of these Precisions from dropdown: Date, Date and Time, Month and Year and Year You can select Year in here Quote Link to comment Share on other sites More sharing options...
0 ISlp59lp Posted December 17, 2013 Author Report Share Posted December 17, 2013 MayMusic, Thanks - I found the Precision field. My next question is, can this be changed dynamically? I actually have three drop down created (year, month, date). One user might select just the year. Another user might select both the year and the month. Is there a way to change the precision value of the field on the search page to match what the user has input? Or, are there some default values that would work? (for instance, if year is selected and month is not selected, yet the precision is set to Month and Year?) Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted December 18, 2013 Report Share Posted December 18, 2013 In the search page for this field try to add criteria to the field and select OR as the operator between values. But you only have Date, Date and Time, Month and Year and Year options you cannot only choose Month !!! Give it a try and let me know though. To add criteria to the field highlight the field name in Configure Search Field screen and then from the picker where you add HTML Block/Header/Footer you can also select Criteria ShWolf 1 Quote Link to comment Share on other sites More sharing options...
0 ISlp59lp Posted December 18, 2013 Author Report Share Posted December 18, 2013 I did something a little different -- (but it doesn't seem to work...) I created virtual fields for the year-month-date selections, then modified the value of the gamedatetime field and also the precision of the gamedatetime field. (See below.) But, the results select all dates, not restricted to year or month-year. <script language ="JavaScript"> function setdate () { Stamp = new Date(); year = document.getElementsByName('cbParamVirtual1')[0].value; month = document.getElementsByName('cbParamVirtual2')[0].value; day = document.getElementsByName('cbParamVirtual3')[0].value; if ((year !== "") && (month !== "") && (day !=="")){ document.getElementsByName('VE_game_gamedatetime').precision = "Date"; alert(document.getElementsByName('VE_game_gamedatetime').precision); fulldate = month + "/" + day + "/" + year; document.getElementsByName('VE_game_gamedatetime').value = fulldate; alert(document.getElementsByName('VE_game_gamedatetime').value); } else if ((year !== "") && (month !=="")){ document.getElementsByName('VE_game_gamedatetime').precision = "Month and Year"; alert(document.getElementsByName('VE_game_gamedatetime').precision); fulldate = month + "/" + year; document.getElementsByName('VE_game_gamedatetime').value = fulldate; alert(document.getElementsByName('VE_game_gamedatetime').value); } else { if (year == "") year = Stamp.getFullYear(); document.getElementsByName('VE_game_gamedatetime').precision = "Year"; alert(document.getElementsByName('VE_game_gamedatetime').precision); fulldate = year; document.getElementsByName('VE_game_gamedatetime').value = fulldate; alert(document.getElementsByName('VE_game_gamedatetime').value); } sportid = document.getElementsByName('cbParamVirtual4')[0].value; schoolname = document.getElementsByName('cbParamVirtual5')[0].value; oppschool = document.getElementsByName('cbParamVirtual6')[0].value; document.getElementsByName('VE_game_sportid').value = sportid; document.getElementsByName('VE_school_schoolname').value = schoolname; document.getElementsByName('VE_Lookup_School_schoolname').value = oppschool; alert(" sportid " + document.getElementsByName('VE_game_sportid').value + " school " + document.getElementsByName('VE_school_schoolname').value + " oppschool " + document.getElementsByName('VE_Lookup_School_schoolname').value); } /* onload=setdate; */ document.getElementById("caspioform").onsubmit = setdate; </script> Quote Link to comment Share on other sites More sharing options...
0 ISlp59lp Posted December 19, 2013 Author Report Share Posted December 19, 2013 I've tried to simplify the search to see if I could get something going - no go yet - still need help. Using Search and Report Wizard: - Select Search Fields: VE_game_sportid, VE_game_gamedatetime - Configure Search Fields: DataPage Elements Virtual1 - Dropdown (custom values: 2014,2013,2012,2011) VE_game_sportid - Hidden, Default Value = 1 VE_game_gamedatetime - Hidden, precision = Date Footer is this code: <script language ="JavaScript"> function setdate () { Stamp = new Date(); console.log("yippee"); year = document.getElementsByName('cbParamVirtual1')[0].value; console.log("input year: %s",year); if (year == "") year = Stamp.getFullYear(); console.log("set year: %s",year); var y = document.getElementsByName("VE_game_gamedatetime"); y.precision = "Year"; console.log("y: '%s'", y.precision); fulldate = year; y.value = fulldate; console.log("Date: '%s'",y.value); } document.getElementById("caspioform").onsubmit = setdate; </script> Still the results of this are for all years, not just the selected year. What am I missing? Quote Link to comment Share on other sites More sharing options...
0 ShWolf Posted January 11, 2014 Report Share Posted January 11, 2014 Hi You can't change precision of the field via JS. And as for your last post, looks like the same you can do without JS, just select Dropdown/Listbox form element for the VE_game_gamedatetime field and select precision 'year'. In the 'Source' dropdown select 'Custom values' and insert your custom values "2014,2013 etc." So in this case you don't need any JS and virtual fields. As for the other cases, best solution is described in MayMusic's post Quote Link to comment Share on other sites More sharing options...
Question
ISlp59lp
I'm using the Search and Report Wizard.
I have a table(tbl_game) with one column containing a datetime field. (ex: 09/25/2009 18:00:00)
I have created the search form with a dropdown that allows user to select specific year (ex: 2009)
Now, how do I generate the search such that the report yields only those records with the selected year (ex: only 2009 games)?
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
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.