Calendar for Date Filter

As described in the SAP Library I want to use the following JavaScript function to call up a calendar:
<A href="Javascript:SAPBWSetFilterByCalendar('KPM',null,'0CALDAY','20041117');">Filter Calday</A>
When I click on my link I get a Runtime Error.
Line: 1
Error: 'Items' is undefined
Can anyone please tell me what I'm doing wrong?

Hi,
  Take a look at this code. This is to restrict a data provider by Month selection with dropdown box. This is an fully working code.
<HTML>
<!-- BW data source object tags -->
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="SET_DATA_PROVIDER"/>
<param name="NAME" value="DP2"/>
<param name="QUERY" value="WORKSHOP_DYNAMIC_CONTROL"/>
<param name="INFOCUBE" value="0D_SD_C03"/>
DATA_PROVIDER: DP2
</object>
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="SET_DATA_PROVIDER"/>
<param name="NAME" value="DP1"/>
<param name="QUERY" value="WORKSHOP_CALMONTH_DROPDOWN"/>
<param name="INFOCUBE" value="0D_SD_C03"/>
<param name="FILTER_IOBJNM" value="0CALMONTH"/>
<param name="FILTER_VALUE" value="200401"/>
DATA_PROVIDER: DP1
</object>
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="SET_PROPERTIES"/>
<param name="TEMPLATE_ID" value="ZOJM_DDBOX_HOW_TO_CODE_ALONG"/>
TEMPLATE PROPERTIES
</object>
<SCRIPT type='text/javascript'>
function chavl_int_to_ext_convert(intformat, iobjnm) {
if (iobjnm== '0CALMONTH') {
var date_format = SAPBWGetProperty('DATE_FORMAT');
switch (date_format) {
case 1:
return intformat.substring(4,6) + '.' + intformat.substring(0,4);
case 2:
return intformat.substring(4,6) + '/' + intformat.substring(0,4);
case 3:
return intformat.substring(4,6) + '-' + intformat.substring(0,4);
case 4:
return intformat.substring(0,4) + '.' + intformat.substring(4,6);
case 5:
return intformat.substring(0,4) + '/' + intformat.substring(4,6);
case 6:
return intformat.substring(0,4) + '-' + intformat.substring(4,6);
function setVariable(value) {
// ignore the '#' and "!ALL" values
if (value == '000000' || value == '!ALL')
alert("Please select a valid month.");
else {
url = SAP_BW_URL_Get() + "&CMD=PROCESS_VARIABLES&SUBCMD=VAR_SUBMIT&VAR_NAME_1=ZMONTH&VAR_VALUE_EXT_1=" ;
url = url + chavl_int_to_ext_convert(value,'0CALMONTH');
SAPBWOpenURL(url);
function chavl_ext_to_int_convert(extformat, iobjnm) {
if (iobjnm== '0CALMONTH') {
var date_format = SAPBWGetProperty('DATE_FORMAT');
// possible values DATE_FORMAT: Date format (1: DD.MM.YYYY, 2: MM/DD/YYYY, 3: MM-DD-YYYY,
// 4: YYYY.MM.DD, 5: YYYY/MM/DD, 6: YYYY-MM-DD)
if (date_format < '4')
return extformat.substring(3,7) + extformat.substring(0,2);
else
return extformat.substring(0,4) + extformat.substring(5,7);
function set_dd_box() {
//retrieve the value of the text element ZMONTH
ddvalue = document.getElementById('varvalue').innerHTML;
// convert the external representation to the internal representation
// needed for selecting a value in the dropdown box
ddvalue_int = chavl_ext_to_int_convert(ddvalue,'0CALMONTH');
// using the document object model (DOM), get the number of values
// in the dropdown box, loop through the entries and compare the retrieved
// value against the dropdown box contents. If there is a match, set the value
// as the 'selected' value
for (i=0; i< document.frmState.calmonth.options.length; i++) {
if (document.frmState.calmonth.options<i>.value == ddvalue_int)
document.frmState.calmonth.selectedIndex = i;
</SCRIPT>
</HEAD>
<BODY>
<P>
<form name="frmState">
<b> Calendar month/year:</b> <select name="calmonth" class="SAPBexDdl" onchange="setVariable(options[selectedIndex].value);">
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="DROPDOWNBOX_1"/>
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_FILTER_DDOWN"/>
<param name="DATA_PROVIDER" value="DP1"/>
<param name="GENERATE_CAPTION" value=""/>
<param name="IOBJNM" value="0CALMONTH"/>
<param name="BOOKED_VALUES" value=""/>
<param name="SHOW_LABEL" value=""/>
<param name="ONLY_VALUES" value="X"/>
<param name="NO_REMOVE_FILTER" value="X"/>
ITEM: DROPDOWNBOX_1
</object>
</select>
</form>
</P>
<P><object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="TABLE_1"/>
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID"/>
<param name="DATA_PROVIDER" value="DP2"/>
ITEM: TABLE_1
</object></P>
<P id="varvalue" style="DISPLAY: none; VISIBILITY: hidden"><object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="TEXTELEMENTS_1"/>
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS"/>
&#63193;2004 SAP LABS, LLC AND SAP AG 9 <param name="DATA_PROVIDER" value="DP2"/>
<param name="GENERATE_CAPTION" value=""/>
<param name="ELEMENT_TYPE_1" value="VARIABLE_KEY"/>
<param name="ELEMENT_NAME_1" value="ZMONTH"/>
<param name="ONLY_VALUES" value="X"/>
ITEM: TEXTELEMENTS_1
</object></P>
<script>
<!--
set_dd_box();
-->
</script>
</BODY>
</HTML>
Assign points if this helps
arun

Similar Messages

  • SP2013 - Date Filter Web Part looses connection when used in a site template

    Hi,
    I created two table reports in SQL Reporting Services 2012 and inserted in a web page using the Reporting Service Report viewer in SharePoint 2013 with CU Dez 2013. The two reports require two dates and I use two date filter web parts (I did not try the
    date range solution I saw in the fórum).
    So the user inputs the two dates in date filters that send the information to thereports in the same page.
    They work in the site and I saved it as template. However when I create e new site using it as a templates, the date filter connections are broken and of course, they did not work.
    For another report where I usea text filter, it worked without any problem in the template.
    Does anybody know any workaround?
    Thank you.
    Best regards, Ricardo Segawa - Segawas Projetos / Microsoft Partner

    Hi ,
    The new site based on the saved site template will generate new ID for date filter web part, in the web part page the SPWebPartConnection "ProviderID" value seems still to reference the original date filter web part ID (see from
    SharePoint Designer), as a workaround we can re-configure the web part connection from the web part page manually or programmatically from that new site web part page.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/8d98206d-b41f-4ee4-b537-a4bf5cec0434/sharepoint-2010-save-site-as-template-webpart-connections-broken?forum=sharepointgeneralprevious
    http://sympmarc.com/2007/09/20/removing-a-web-part-connection-in-sharepoint/
    Thank
    Daniel Yang
    TechNet Community Support

  • Calendar prompt for Date variable from bex

    Hi All,
    I have a Bex query where I have a variable on 0CALDAY
    - Customer exit (i_step = 1 to populate with current date)
    - Single value
    - Mandatory
    I created universe on this query and in webI selection screen i do see the variable prompt.
    I am not able to see the current date populated automatically since exit values are not populated to WebI at runtime.
    My problem is that in WebI selection screen we get list of date values from the info provider instead of Calendar prompt
    where user can enter the values directly.
    I am currently on BO XI 3.1 SP3.
    Is there any specific setting in Universe or bex query which is required to get this Calendar prompt instead of list of values for dates?
    Note: When we were on SP1 the universe created then had same variable from bex and it still shows us Calendar prompt but ever since we upgraded to SP3 for the query splitter functionality we not able to get the calendar prompt for date variable in new universe we create
    Thanks
    Ritesh

    Yep.
    Now tell me how you want to show that Prompt @ WebI report level.
    My problem is that in WebI selection screen we get list of date values from the info provider instead of Calendar prompt
    where user can enter the values directly. Exactly, i didn't get this??
    @Prompt:
    You have flexibility to show options like:
    Mono/Multi: User can select Single value or Multiple.
    BW Variable: Same we have (Single/Multiple)
    Free/Constrained: User can Enter his/her value directly or No change option.
    BW Variable: By defalut you will get this, once you made it to Optional input.
    Persistent/Not_Persistent: Refreshed report has to show last selected value means use Persistent otherwise Not_P.
    By seeing the Prompt syntax , I can say your Variable is after Customer Exit, Correct??
    Workaround for your Problem is:
    <FILTER KEY="ZV_DATE"><CONDITION OPERATORCONDITION="Equal"><CONSTANT TECH_NAME="@Prompt('Date (Previous Day)','A','Date\LovDate (Previous Day)Base',mono,primary_key)"/></CONDITION></FILTER>
    You have to remove that Date class and objects from prompt syntax. Because of that it showing up LOV's not calendar.
    Like:
    <FILTER KEY="ZV_DATE"><CONDITION OPERATORCONDITION="Equal"><CONSTANT TECH_NAME="@Prompt('Date (Previous Day)','A',',mono,primary_key)"/></CONDITION></FILTER>
    Why, It should be blank??
    Because Date needs no class\object to show up, by default you will get Calendar on the fly.
    Hope you got my point.
    Thank You!!

  • How to create a data filter for BAPI used in a Distribution Model ?

    I am trying to create IDOC's for a QM inspection plan via message type QPMK in ECC 6.0. When creating the new message type in the Distribution Model, it forced me to use a BAPI (MasterInspectionChar) rather that just the message as I have done in the past. In order to ensure that only IDOC's related to a specific plant and material type get sent out, I was trying to create a filter.
    I am able to get into a 'Change Filter' dialog by double clicking 'No data filter set' under the node 'MasterInspectionChar.SaveReplica'. However, an attempt to highlight anything on this dialog and clicking button 'Create filter group' results in msg. 'Select node: Content-dependent parameter filtering'.
    Online help led me in a different direction, one thread led me to believe I needed to create a table entry for the filter in table TBD16 via BD81 for later attachment to the BAPI in the Distribution Model. Before this, I created two Z* ALE Object Type records for plant and material type in table TBD11 via BD95 for what I thought would provide a lookup back in BD81 for creation of a new filter record, but these objects are not found. Per the help, I am also unclear as to whether I would need to set up Receiver determination or Parameter filtering, nor where to make this step in the configuration happen?
    Can anyone point me back in the correct direction to get a data filter set up for this BAPI within the Distribution Model ?
    Thanks - Mike

    Just to clarify, what I am having trouble with is finding where exactly to plug in the name of the plant to be filtered? If using a message type such as MATMAS in a distribution model, it is very straight forward to navigate down from the 'Data filter active', and assign a value to whatever field you wish to filter via the 'List of Values'.  But in this example, message type QPMK required use of the BAPI MasterInspectionChar, and therefore the different method in creating the filter. 
    I cannot find similar functionality when navigating the BAPI related row, for MasterInspectionChar. The 'Change Filter' dialog popup displays a row for 'Container' and then 3 more rows containing 'BAPI structure...'.   Clicking the 'Attribute' checkbox on any of these rows sets 'Data filter active' as a node under the BAPI.  Double clicking the 'Data filter active' brings me back into the same dialog, and selecting any row with an attempt at this point to create a filter results in the 'Select node: content-dependent parameter filtering' warning.  Is this warning occuring because of missing configuration?
    Thanks - Mike

  • Calendar Tile on Windows 8.1 displaying incorrect date for icloud calendar but date icon displays correct date on iPhone 5 and iPad Air

    Calendar Tile on Windows 8.1 displaying incorrect date for icloud calendar but date icon displays correct date on iPhone 5 and iPad Air.  Date on Windows 8.1 is correct.  Thank you.

    Try doing  a reset on your phone. Sounds like your carrier's time set is not getting through to your device. If the reset doesn't do it, then go to Settings>General>Reset>Reset Network Settings. That should do it.

  • How to put up a calendar in VI for date selection?

    Hi all,
    I need to put up a calendar in my VI for date selection to view historical data like we find on websites of travel agents?
    & also guide me how to get this kind of calendar.....
    please guide me...
    Thanking You,
    Vaibhav Gandhi
    B.E. Instrumentation & Control,
    INDIA
    Solved!
    Go to Solution.

    Thank you so much GURU for your very quick & accurate reply.
    Further I need to know, that how I can remove the word 'value' from indicator? i.e. it is giving "Value -> 6/1/2009" on indicator.. I just need '6/1/2009' on indicator...
    Can it be possible?
    Thanks,
    Vaibhav Gandhi
    B.E. Instrumentation & Control,
    INDIA

  • IDOC: Problem with data filter for IDOC extension field

    Hallo!
    I've created an idoc extension for the basic type DEBMAS06 that works fine. Now I want to use a data filter for one field ( company code ) of my segment. Every segment with a company code different from 100 should be filtered and not send to the other client. But what happend is that for all customers that have at least one company code different from 100, all segments including the one with cc 100 were deleted and a error "Segment ... does not exist for message type DEBMAS" appeared on the screen.
    Does anyone have any ideas about this problem?

    Not sure about changes to be made at the filtering options.
    An alternative would be sending the data to XI as it is and perform the mapping to remove the unnecessary segments.
    Disadvantage: Unnecessary processing of segment would be done at XI.
    Advantage: The integration logic would be completely handled by XI.
    Regards,
    Prateek

  • Is there a fix for seeing bolded dates in navigation calendars for shared calendars (when appts have been made on certain dates) as was the case in Office 2003?

    Is there a fix for seeing bolded dates in navigation calendars for shared calendars (when appts have been made on certain dates) as was the case in Office 2003?
    Looks like in 2011 someone posted on the forum that it was being looked into, but has there been a fix?  It's now two years later?
    Thank you!!

    Hi,
    According to your description, it seems that the issue is related to Outlook 2003. This forum focus on Exchange 2013. Additionally, Outlook 2003 is no longer supported in Exchange 2013.
    I suggest we can ask this question in Outlook forums for more professional answers:
    http://social.technet.microsoft.com/Forums/office/en-US/home?forum=outlook
    Thanks,
    Winnie Liang
    TechNet Community Support

  • Use Date Filter WebParts for Date Range In Sharepoint 2013

    Hi,
    Can someone please explain how to use the Date Filter WebParts in Sharepoint 2013 to act as a Date Range. Myrequirement is exactly like in the link
    Date Filter but this is not working on Sharepoint 2013 Designer. I am unable to edit a webpart page in Designer, add and configure these webparts.
    Request you to please help!!

    Now/Today probably isn't supported because it simply cannot work the way most people (including myself) would like for it to work.  The calculation only executes when an item is created or updated.  It does not recalculate when you view or retrieve
    the value (say through a workflow) from the field.  Because of this, "Today" would be misleading as it doesn't really mean today, but the last time the field was recalculated (created/updated).
    If the recalculation occurred each time the field was accessed or viewed, that would be of tremendous benefit.

  • Calendar...list function shows only events for date select instead of events from that date forward.

    Calendar list function shows only events for date selected....instead of events for date selected and events forward from that date.  Is there a setting change needed?  Help!

    Hi,
    Did you check that your universe object referring "Date of Completion" has Date data type?
    Can you also provide the BOE verson you are using?
    I remembered that the calendars were not displayed in XIR2 version.
    Didier

  • Parsing Failed for Date in Prompt

    Hi Folks,
    I am having Parsing Issue on "Key Date"  Object in Universe. See the Error and Code below for your review
    Error: Parse Failed: Exception: DBD, The value entered is not valid. It must adhere to one of the following formats.
              YYYYMMDD
               DD.MM.YYYYState:N/A
    Code:
            <OPERATOR VALUE="AND"><OPTIONAL><FILTER KEY="[0I_DAYIN]"><CONDITION OPERATORCONDITION="Between"><CONSTANT TECH_NAME="@Prompt('Day Interval From','A','Calendar Day\LovDay IntervalBase',mono,primary_key)"/><CONSTANT TECH_NAME="@Prompt('Day Interval To','A','Calendar Day\LovDay IntervalBase',mono,primary_key)"/></CONDITION></FILTER></OPTIONAL><FILTER KEY="[0P_KEYDA]"><CONDITION OPERATORCONDITION="Equal"><CONSTANT TECH_NAME="@Prompt('Key Date','D',,mono,free)"/></CONDITION></FILTER></OPERATOR>
    This universe is created by someone else and client need to modify it with a calendar but i did not modify it yet however its already giving me the hard time. Kindly advise, any kind of help will be appreciated
    Thanks

    Use the code below for the filter:
    <OPERATOR VALUE="AND">
         <OPTIONAL>
              <FILTER KEY="[0I_DAYIN]">
                   <CONDITION OPERATORCONDITION="Between">
                        <CONSTANT TECH_NAME="@Prompt('Day Interval From','D',,mono,free)"/>
                        <CONSTANT TECH_NAME="@Prompt('Day Interval To','D',,mono,free)"/>
                   </CONDITION>
              </FILTER>
         </OPTIONAL>
              <FILTER KEY="[0P_KEYDA]">
                   <CONDITION OPERATORCONDITION="Equal">
                        <CONSTANT TECH_NAME="@Prompt('Key Date','D',,mono,free)"/>
                   </CONDITION>
              </FILTER>
    </OPERATOR>
    Regards

  • Filtering by Calendar versus Date

    Hi All,
    So, we can filter on Calendar, which shows a nice graphical representation of when we took our pictures. Click on a highlighted date, and see all the photos from that *one specic* date.
    However, to see, for instance, everything from a month (or an arbitrary range), it doesn't seem possible from the Calendar, even though it shows me several days in some particular months that I took photos. I have to use the "Date" filter and clunkily change a bunch of criteria in order all photos from a given month.
    Am I missing something? It seems like the Calendar Filter interface should make this task a cinch, and I don't think the Date filter will work for scans, in which the metadata is what I want to search, not the file date.
    nathan

    Use "{Shift}+click" for the second date, or use "{Command}+click" for additional dates.
    The Calendar Rule is slick, but seems unfinished. There is no way I know to move the mini-calendars by year or to the most recent date, for instance. The central diamond does move the mini-calendars to display the current date.
    The Calendar Rule uses the EXIF date.
    http://documentation.apple.com/en/aperture/usermanual/index.html#chapter=14%26se ction=12%26tasks=true
    The Date Rule, with the argument "Is in the range" does the same thing as the Calendar Rule, and is often faster to set.
    The Date Rule uses the file's creation date (afaict).
    Message was edited by: Kirby Krieger

  • Issue in assigning new Planning Calendar for MRP.

    Hello Experts
    I have trouble in setting up new Planning calendar for S&OP and MRP process. Let me explain in details
    Requirement is, currently I am using standard country specific Factory calendar format (monthly period) per plant. But new requirement has came up and Company wants to change beginning and end of period (monthly) -- as shown below
    Current Calendar
    1 July to 31 July = period 1 - 2014
    1 Aug to 31 Aug = Period 2 - 2014
    and so on..
    New requirement is ( Last week of Friday is end of Period) 
    Sat 28 June to Fri 25 July = Period 1 - 2014
    Sat 26 July to Fri 29 Aug = Period 2 - 2014
    Sat 30  Aug to Fri 3 Oct = Period 3 - 2014
    and so on..
    (basic concept is to keep
    4wk, 5wk, 5wk for Quarter 1
    4wk, 4wk, 5wk for Quarter 2. and so on.. )
    I have setup new planning calendar in MD25..
    ie. min period, start of period not a working day, Calculation rule & Period etc...
    then assigned new planning calendar in MM02 - MRP2 and also in MRP1 used Lot size PK... etc..
    But when i Put demand in MC88.. which gives us std month format and transfer to DM, then Ran MRP but some how MRP is not creating correct Qty in planned demand as per new calender..
    i.e..  1 July to 31 July = period 1 - 2014  if total demand Qty for Material XYZ is : 50
            I am expecting planned demand result in MRP as...   Sat 28 June to Fri 25 July = Period 1 - 2014  - should be 50 in total.. but It's not..
    Any reason? Or I am missing some settings?
    Thank you in advance..
    PC...

    Thanks KK/Umesh
    Business wants planning calendar in this format. And Fiscal Year Variant has also been set according to new calendar.
    KK, Regarding MC88 there is no option to incorporate planning calendar into S&OP process. And Organisation's S&OP process is set from day one (Planning by ProdGrp/Material) so MD61 would not be a good option to use.
    Umesh, regarding "start of period not a working day", I have selected "do not displace". And 27/09 and 27/12 dates are set holiday. The major issue here is: Not every 4th Sat of month is Period start day, MRP is picking new planning calendar (defined in above table) from the system But some how when transferring forecast data from planning table to demand management (MC88), system don't recognize new planning calendar and it distributes demand over weekly bucket per regular month Calendar instead of new planning calendar..
    Some how I need to incorporate new planning calendar into S&OP setup somewhere, Any thoughts?
    Thanks.
    PC    

  • Function Modules for Data and Time

    Hi all,
              I need 2 function modules for date and time. when we pass current data(sy-datum) and current time (sy-uzeit) into function modules, shoud get date in <b>dd/mm/yyyy or dd.mm.yyyy</b> and time in<b> HH:MM:SS</b> formats.
    Thanks in advance

    Hi Ranjith,
    i think this will b usefull for you..
    SAP Bar Chart Function Modules and what they are used for
    Function module
    Used for
    BARC_GRAPHIC_PBO
    Starting bar chart at PBO time, using a graphic profile (parameter PROFILE)
    BARC_GRAPHIC_PAI
    Analyzing data returned by the graphic
    BARC_SET_TIME_AXIS
    Setting start and end of time axis
    BARC_SET_OPTIONS
    Setting options
    BARC_ADD_CHART
    Creating a chart
    BARC_SET_CHART_ATTRIB
    Setting chart attributes
    BARC_ADD_SECTION
    Creating a section on the time axis
    BARC_SET_SECTION_ATTRIB
    Setting section attributes
    BARC_ADD_RIBBON
    Adding a ribbon to the time axis
    BARC_SET_RIBBON_ATTRIB
    Setting attributes for ribbons in the chart
    BARC_ADD_GRID
    Adding a time grid
    BARC_SET_GRID_ATTRIB
    Setting grid attributes
    BARC_ADD_LAYER
    Adding a layer (graphic elements)
    BARC_SET_LAYER_ATTRIB
    Setting layer attributes
    BARC_ADD_LINE
    Adding a line
    BARC_ADD_CALENDAR
    Creating a calendar
    BARC_SET_CALENDAR_ATTRIB
    Setting attributes for a calendar
    BARC_ADD_TIME_PROFILE
    Creating time profiles
    BARC_SET_TIME_PROFILE_ATTRIB
    Setting attributes for time profile
    BARC_ADD_INTERVAL
    Adding a time interval
    BARC_SET_INTERVAL_ATTRIB
    Setting time interval attributes
    BARC_ADD_TIME_OBJECT
    Creating a time object
    BARC_CONVERT_DATE
    Creating a date string in bar chart format
    BARC_REVERT_DATE
    Converting a date string in bar chart format to date and time
    BARC_ADD_DATELINE
    Creating a date line
    BARC_SET_DATELINE_ATTRIB
    Setting dateline attributes
    BARC_GET_PROFILE_CONTENTS
    Obtaining profile contents for customizing a chart
    BARC_GET_COLUMN_WIDTH
    Selecting new column width
    BARC_SET_COLUMN_WIDTH
    Setting the column width
    BARC_GET_TEXTINDEX
    Obtaining the text index of a field
    BARC_SET_LABELS
    Positioning the chart display
    BARC_SET_COLUMN_ATTRIB
    Setting column attributes
    BARC_SET_ROW_ATTRIB
    Setting row attributes
    BARC_SET_ROW_HEIGHT
    Setting the line height
    BARC_SET_MAXCHARTS
    Setting the maximum number of charts sent
    <b>If its usefull reward points
    </b>

  • Performance issue on Date filter

    In my where condition I wanted a date filter on sale date.  I want all sales after 9/1/2014.   
    CASE1
    If I explicitly use date filter like 
    SaleDate > '2014-09-01 00:00:00:000' I am getting the result in 2 seconds.
    CASE2
    Since I may need to use this data value again, I created a date table with single column "date" and loaded the value '2014-09-01 00:00:00:000' . 
    So now my where is like 
    SaleDate > (Select date from dateTable)
    When I run this , the result does not show up even after 10 mins. Both date types are datetime. I am baffled.  Why is this query not coming up with the result?

    As mentioned by Erland, for the optimizer, both situation are very different. With a literal, the optimizer can properly estimate the number of qualifying rows and adapt the query plan appropriately. With a scalar subquery, the value is unknown at compile
    time, and the optimizer will use heuristics to accommodate any value. In this case, the selection for all rows more recent than September 1st 2014 is probably a small percentage of the table.
    I can't explain why the optimizer or engine goes awry, because the subquery's result is a scalar, and shouldn't result in such long runtime. If you are unlucky, the optimizer expanded the query and actually joins the two tables. That would make the indexes
    on table dateTable relevant, as well as distribution and cardinality of dateTable's row values. If you want to know, you would have to inspect the (actual) query plan.
    In general, I don't think your approach is a smart thing to do. I don't know why you want to have your selection date in a table (as opposed to a parameter of a stored procedure), but if you want to stick to it, maybe you should break the query up into something
    like this. The optimizer would still have to use heuristics (instead of more reliable estimates), but some unintended consequences could disappear.
    Declare @min_date datetime
    Set @min_date = (SELECT date FROM dateTable)
    SELECT ...
    FROM ...
    WHERE SaleDate > @min_date
    If you use a parameter (or an appropriate query hint), you will probably get performance close to your first case.
    Gert-Jan

Maybe you are looking for

  • Using array from one vi in another vi

    Hi, Im new with NI LabView and i have few Qs: 1. I'm writing a vi and I'm creating a numeric array in it. How can I use the array (It's content) in a different vi that's I'm writing? 2. How do I link between vi's? Im writing few vi's and pressing a b

  • Inventory management

    Hi, In Inventory management ...for reports i am using standard queries taken from metadata repository but i am not using the standard cube instead using a custom cube and copied all those queries on to custom cube...since for all figures routines hav

  • How to send back the stauts of inbound idoc to outbound system

    Hi  all. Idocs are scheduled to send from outbound to inboud.In inbound I have many idocs with status 51.(application document not posted).I need to report back the details of all the  idocs with status 51.(application document not posted) .ie I need

  • Precision for Capacity Planning for Response Group Lync 2010

    Hi, does anyone have information on the following points: Concurrent calls connected to IVR or MoH 480 60 --> I think that each FE can support 60 simultaneous calls on the MOH Concurrent anonymous sessions (without IM) 224 28 --> I think that each FE

  • Is it possible to create a button to take a screengrab on ipad?

    and what would the code be to do this? thanks!