Using a sparse lookup with a date range?

Hey all,
I have created a table (Benchmark_Lookup) that contains the following columns:
start_date, end_date, section, benchmark
I then have numerous logical tables (Eg Business Growth) that will all have a new logical column performing a sparse lookup on the above table to retrieve it's benchmark value.
In the lookup table, I have multiple rows for the same section with different benchmarks differentiated by the date range that they were in effect.
I have worked out how to perform this lookup using the following:
lookup(SPARSE "bla".Benchmark_lookup"."Benchmark" ,0, "bla"."Business_Growth"."section")
Unfortunately, the above is now bringing back duplicates as it's not working out what date range to select from.
I have joined the lookup table (using a physical join) to my Time dimension by saying "business_date >= start_date and business_date <= end_Date" but that doesn't seem to work.
Any ideas?

Hi there,
Neither of these examples help that much.
I understand how the lookup function works but what happens if the lookup table has the following two rows:
EFFECTIVE_FROM     EFFECTIVE_TO     SECTION     SCORE
01/Jan/1900                 30/Jun/2013           test              1
01/Jul/2013                  06/Jun/2079           test              2
I need to use the following lookup rules:
Business_Date >= Effective_From
Business_Date <= Effective_To
Section = 'Test'
The lookup should therefore only ever return one row as the date is used to find the appropriate range.

Similar Messages

  • Using Fields in Reports with stored Data

    Hello,
    i like to use fields in Reports with saved Data in it.
    Is this possible ?
    Example:
    A Invoicereport with saved Data  in a File. Now i like to get the Field Invoice_ID to use this in VB.net.
    Any Idea ?
    VS2008 with CR_reports in 8.5
    Thanx

    You wrote:
    Example:
    A Invoicereport with saved Data in a File. Now i like to get the Field Invoice_ID to use this in VB.net.
    You can export a report with saved data and then change the filtering without hitting the DB again. If you are asking if using a flat file as the data source there are multiple ways to do this. Define an ODBC data source to the file and specify the sturcture, or using ADO.NET and a record set, or using XML as the data source. Lots of ways in newer versions of CR. 8.5 was limited so the ODBC example is your best option.
    Or if you are asking how to get the data from the report you can use REadRecords. Not sure if 8.5 has this functionality though. It's way past it's end of life so I can't look.
    You wrote:
    VS2008 with CR_reports in 8.5
    Not supported, 8.5 has no .net assemblies and no RDC, only option would be to use RAS to make changes or reading records so you need to upgrade.

  • Using ConnBean and CursorBean with a Data Source

    Hi all,
    I',m making a web app. using the Jdev (RUP4) with OA Extension. I looked in the help menu under "About Data-Access JavaBeans and Tags". Here I found the following example, but for some stange reason I cannot get the setProperty to work.
    Example: Using ConnBean and CursorBean with a Data Source This following is a sample JSP page that uses ConnBean with a data source to open a connection, then uses CursorBean to execute a query.
    <%@ page import="java.sql.*, oracle.jsp.dbutil.*" %>
    <jsp:useBean id="cbean" class="oracle.jsp.dbutil.ConnBean" scope="session">
    <jsp:setProperty name="cbean" property="dataSource"
    value="<%=request.getParameter("datasource")%>"/>
    </jsp:useBean>
    <% try {
    cbean.connect();
    String sql="SELECT ename, sal FROM scott.emp ORDER BY ename";
    CursorBean cb = cbean.getCursorBean (CursorBean.PREP_STMT, sql);
    out.println(cb.getResultAsHTMLTable());
    cb.close();
    cbean.close();
    } catch (SQLException e) {
    out.println("<P>" + "There was an error doing the query:");
    out.println("<PRE>" + e + "</PRE>\n<P>"); }
    %>
    Does anyone know how to set the "Property" to a datasource and make it work?
    Best regards,
    MHCI

    There is no point-and-click (Import Data Source Metadata) way to use an LDAP server as a datasource. You have to use the Java Function provided on dev2dev. If you need help with it, please post here.
    - Mike

  • Query for all open sales order with a date range

    Hi Experts!
    I wrote this query that will look up all open sales order of a particular customer and how much was served:
    SELECT T0.[DocNum] 'OS #', T0.[DocDate] 'Posting Date', T0.[CardName] 'Customer',  T1.[Dscription] 'Item Description',T4.[SalUnitMsr] 'Sales UOM', T4.[InvntryUom] 'Invty UOM', T1.[UseBaseUn] 'Use of Invty UOM' , T1.[Quantity], T1.[Quantity]-T1.[OpenQty] 'Served Qty', T1.[OpenQty] 'Unserved Qty' FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.[DocStatus] = 'O' and T0.[CardName] =[%0]
    However, I don't know how to input a parameter for the date range in a query.  Can anyone help with this issue?
    Your input will be highly appreciated.
    Warm regards,
    Jen

    Hiiiiiii
             Try This.....
    SELECT T0.DocNum 'OS #', T0.DocDate 'Posting Date', T0.CardName 'Customer', T1.Dscription 'Item Description',T4.SalUnitMsr 'Sales UOM', T4.InvntryUom 'Invty UOM', T1.UseBaseUn 'Use of Invty UOM' , T1.Quantity, T1.Quantity, T1.OpenQty 'Served Qty', T1.OpenQty 'Unserved Qty' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.DocStatus = 'O' and T0.CardName ='[%0]' and (T0.DocDate>='[%1]' and T0.DocDate<='[%2]')
    Regards,

  • Using spry to filter age or date range?

    I'm trying to create a spry filter to filter between age or date ranges. I can get the code to filter an age if it's greater or below a number, but not a range between numbers. How can I modify the following code to filter between a  range of numbers? I would prefer to use drop down for age range choices so the user can choose each age from a drop down menu but I wasn't having much luck with it whereas the checkbox was somewhat working for me. If someone has a drop down method to select ages and have spry filter between the values I would be very grateful. Many thanks in advance!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Multiple Filters Sample</title>
    <link href="http://labs.adobe.com/technologies/spry/css/samples.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" type="text/javascript" src="http://labs.adobe.com/technologies/spry/includes/xpath.js"></script>
    <script language="JavaScript" type="text/javascript" src="http://labs.adobe.com/technologies/spry/includes/SpryData.js"></script>
    <script language="JavaScript" type="text/javascript" src="http://labs.adobe.com/technologies/spry/includes/SpryDataExtensions.js"></script>
    <script type="text/javascript">
    <!--
    var dsStates = new Spry.Data.XMLDataSet("states.xml", "states/state");
    dsStates.setColumnType("name", "number");
    function ff15(ds, row, index){ var c = row.name; return c >= '6' && c <= '100' ? null : row; };
    function ffIP(ds, row, index){ var c = row.name; return c >= '11' && c <= '100' ? null : row; };
    function ffQZ(ds, row, index){ var c = row.name; return c >= '0' && c <= '10' ? null : row; };
    function ToggleFilter(enable, f)
         if (enable)
              dsStates.addFilter(f, true);
         else
              dsStates.removeFilter(f, true);
    function RemoveAllFilters()
         document.forms[0]["f15"].checked = false;
         document.forms[0]["fIP"].checked = false;
         document.forms[0]["fQZ"].checked = false;
         dsStates.removeAllFilters(true);
    -->
    </script>
    </head>
    <body>
    <div class="liveSample" style="float: left; margin-bottom: 4px;">
         <form action="">
         <label>Show '1' - '5': <input name="f15" type="checkbox" value="" onclick="ToggleFilter(this.checked, ff15);" /></label><br />
         <label>Show '6' - '10': <input name="fIP" type="checkbox" value="" onclick="ToggleFilter(this.checked, ffIP);" /></label><br />
         <label>Show '11' - '20': <input name="fQZ" type="checkbox" value="" onclick="ToggleFilter(this.checked, ffQZ);" /></label><br />
         <input type="button" value="Remove All Filters" onclick="RemoveAllFilters();" />
         </form>
         <div spry:region="dsStates" spry:repeatchildren="dsStates">
              <span>{name}</span>
         </div>
    </div>
    </body>
    </html>
    <states>
         <state>
              <name>1</name>
         </state>
         <state>
              <name>2</name>
         </state>
         <state>
              <name>3</name>
         </state>
         <state>
              <name>4</name>
         </state>
         <state>
              <name>5</name>
         </state>
    etc. etc.
    </states>

    The syntax for the xml file along with the rest of the source was provided in the original post. Here's the modified html file. How do I concactenate if (cat = 2) if (cat = 3) etc. into the function? Thanks in advance.
    Also as you can see from my modified html source, I want two separate drop downs: one for MINage and one for MAx age. From looking at my provided source I have a feeling that when a user clicks on one or the other drop downs it will trigger the function for that selection and cancel the other filter out, which is undesired. So I am wondering how to have two drop downs work to filter between min and max age where if a user clicks on one drop down it doesn't cancel the function of the previous filter selection.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Multiple Filters Sample</title>
    <link href="http://labs.adobe.com/technologies/spry/css/samples.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" type="text/javascript" src="http://labs.adobe.com/technologies/spry/includes/xpath.js"></script>
    <script language="JavaScript" type="text/javascript" src="http://labs.adobe.com/technologies/spry/includes/SpryData.js"></script>
    <script language="JavaScript" type="text/javascript" src="http://labs.adobe.com/technologies/spry/includes/SpryDataExtensions.js"></script>
    <script type="text/javascript">
    <!--
    var dsStates = new Spry.Data.XMLDataSet("states.xml", "states/state");
    dsStates.setColumnType("name", "number");
    function MINage(cat){
         if (cat = 1)
           dsStates.setXPath('states/state[name > 0]');
         dsStates.loadData();
    function MAXage(cat){
         if (cat = 10)
           dsStates.setXPath('states/state[name < 10]');
         dsStates.loadData();
    -->
    </script>
    <style type="text/css">
    <!--
    .badge {
         float: left;
         margin: 4px;
         padding: 4px;
         text-align: center;
         background-color: #FFCC99;
         border-top: solid 1px #999999;
         border-left: solid 1px #999999;
         border-bottom: solid 1px #CCCCCC;
         border-right: solid 1px #CCCCCC;
    label {
         font-weight: bold;
    -->
    </style>
    </head>
    <body>
    <h3>Multiple Filters Sample</h3>
    <div class="liveSample" style="float: left; margin-bottom: 4px;">
    <form action="">
    <select name="ageCat" onchange="MINage(this.value)">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14">14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
        <option value="24">24</option>
        <option value="25">25</option>
        <option value="26">26</option>
        <option value="27">27</option>
        <option value="28">28</option>
        <option value="29">29</option>
        <option value="30">30</option>
        <option value="31">31</option>
        <option value="32">32</option>
        <option value="33">33</option>
        <option value="34">34</option>
        <option value="35">35</option>
        <option value="36">36</option>
        <option value="37">37</option>
        <option value="38">38</option>
        <option value="39">39</option>
        <option value="40">40</option>
        <option value="41">41</option>
        <option value="42">42</option>
        <option value="43">43</option>
        <option value="44">44</option>
        <option value="45">45</option>
        <option value="46">46</option>
        <option value="47">47</option>
        <option value="48">48</option>
        <option value="49">49</option>
        <option value="50">50</option>
        <option value="51">51</option>
        <option value="52">52</option>
        <option value="53">53</option>
        <option value="54">54</option>
        <option value="55">55</option>
        <option value="56">56</option>
        <option value="57">57</option>
        <option value="58">58</option>
        <option value="59">59</option>
        <option value="60">60</option>
        <option value="61">61</option>
        <option value="62">62</option>
        <option value="63">63</option>
        <option value="64">64</option>
        <option value="65">65</option>
        <option value="66">66</option>
        <option value="67">67</option>
        <option value="68">68</option>
        <option value="69">69</option>
        <option value="70">70</option>
        <option value="71">71</option>
        <option value="72">72</option>
        <option value="73">73</option>
        <option value="74">74</option>
        <option value="75">75</option>
        <option value="76">76</option>
        <option value="77">77</option>
        <option value="78">78</option>
        <option value="79">79</option>
        <option value="80">80</option>
        <option value="81">81</option>
        <option value="82">82</option>
        <option value="83">83</option>
        <option value="84">84</option>
        <option value="85">85</option>
        <option value="86">86</option>
        <option value="87">87</option>
        <option value="88">88</option>
        <option value="89">89</option>
        <option value="90">90</option>
        <option value="91">91</option>
        <option value="92">92</option>
        <option value="93">93</option>
        <option value="94">94</option>
        <option value="95">95</option>
        <option value="96">96</option>
        <option value="97">97</option>
        <option value="98">98</option>
        <option value="99">99</option>
      </select>
    <select name="ageCat" onchange="MAXage(this.value)">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14">14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
        <option value="24">24</option>
        <option value="25">25</option>
        <option value="26">26</option>
        <option value="27">27</option>
        <option value="28">28</option>
        <option value="29">29</option>
        <option value="30">30</option>
        <option value="31">31</option>
        <option value="32">32</option>
        <option value="33">33</option>
        <option value="34">34</option>
        <option value="35">35</option>
        <option value="36">36</option>
        <option value="37">37</option>
        <option value="38">38</option>
        <option value="39">39</option>
        <option value="40">40</option>
        <option value="41">41</option>
        <option value="42">42</option>
        <option value="43">43</option>
        <option value="44">44</option>
        <option value="45">45</option>
        <option value="46">46</option>
        <option value="47">47</option>
        <option value="48">48</option>
        <option value="49">49</option>
        <option value="50">50</option>
        <option value="51">51</option>
        <option value="52">52</option>
        <option value="53">53</option>
        <option value="54">54</option>
        <option value="55">55</option>
        <option value="56">56</option>
        <option value="57">57</option>
        <option value="58">58</option>
        <option value="59">59</option>
        <option value="60">60</option>
        <option value="61">61</option>
        <option value="62">62</option>
        <option value="63">63</option>
        <option value="64">64</option>
        <option value="65">65</option>
        <option value="66">66</option>
        <option value="67">67</option>
        <option value="68">68</option>
        <option value="69">69</option>
        <option value="70">70</option>
        <option value="71">71</option>
        <option value="72">72</option>
        <option value="73">73</option>
        <option value="74">74</option>
        <option value="75">75</option>
        <option value="76">76</option>
        <option value="77">77</option>
        <option value="78">78</option>
        <option value="79">79</option>
        <option value="80">80</option>
        <option value="81">81</option>
        <option value="82">82</option>
        <option value="83">83</option>
        <option value="84">84</option>
        <option value="85">85</option>
        <option value="86">86</option>
        <option value="87">87</option>
        <option value="88">88</option>
        <option value="89">89</option>
        <option value="90">90</option>
        <option value="91">91</option>
        <option value="92">92</option>
        <option value="93">93</option>
        <option value="94">94</option>
        <option value="95">95</option>
        <option value="96">96</option>
        <option value="97">97</option>
        <option value="98">98</option>
        <option value="99">99</option>
      </select>
         </form>
         <div spry:region="dsStates" spry:repeatchildren="dsStates">
              <span class="badge">{name}</span>
         </div>
    </div>
    <p><br style="clear: both;" />
    </p>
    </body>
    </html>
    Thanks!

  • Crosstab or Crosstabs with different date ranges not lining up.

    I have a crosstab with a dimension (item) in the vertical axis, and different date ranges on the Horizontal (top) axis.
    I want to display counts of a measure over specific ranges of time. For instance, count of items sold for weeks 1,2,3,4, horizontally, then count of items sold for months 1,2,3,4 horizontally, next to each other.
    Problem is that count rows by item do not line up. Count by week has fewer items, so it has fewer rows than the counts by month. I need it to have the same number of rows, and just show 0 or blank in that row, instead of just not being there. I need all rows to line up by item.
    Its like there needs to be an outer join, but I haven't been able to make it work. What am I missing?
    Does that make sense?
    Any ideas welcome. Thank you!

    Wavery,
    You are looking to display a grid with a high degree of consistency, regardless of the data present.  There is no "single" step capability provided by WebI to achieve this, so it requires creativity on your part.  A second data provider (DP) for your report is necessary and can be either a view in your database, a custom SQL, or some folks have even built a derived table in their universe to accommodate.  At any rate, there are one of two ways to achieve.  If you are familar with SQL and the "union" statement, you would run the basic SQL, then via union, dummy up a second query that has all the requisite columns, but for the measures you would use a value of zero so as not to affect the generated facts.  For example, suppose you had a report for a hardware store, and you wanted to track the following items:  Nails, Flashlights, and Screws.  Your basic query might look like this:
    select item,sum(inventory) from inventory_table where item in ('nail','flashlight','screw') group by item
    Then your next portion of code:
    union select 'Nail',0 union select 'Flashlight',0 union select 'Screw',0
    See how the union is providing "dummy" info?  To do this in WebI with a second DP, you would not use union, but a separate view perhaps, then in WebI apply Merge Dimensions on the item column (and the equivalent of an outer join).
    Thanks,
    John

  • Ical searches with specific date range

    We post the people who are to work at specific events in the notes field of ical. Is there a way to search for these peoples names on the web via ical.php within a specific date range? No matter what date I have set to look at on the calendar the search grabs everything in the past. I only want future events that this person is associated with. Thanks for helping if you can. Jake

    Hi,
    You want to run the report on specific date without 0CALDAY?. Without 0CALDAY you can't restrict the report for specific day. So you must insert 0CALDAY in report and then use Offsets or implement code in CMOD.
    Thanks
    Reddy

  • MDX MTD with a Date Range

    Hi All
    I need some advice on the below, it works, gives the answers I want, but I believe the filter on the set can be moved to a where clause, and the MTD can work effectively then with the sum of the date range on the [RangeHasResponse] measure (advice apart
    from "if it ain't broke don't fix it" ;) ).  This is query for a report where I can sub in a param date range (set the Today value, and the from in the DateRange), and produce the Sum of Has Response across that date range, and also the MTD
    for last month up to the ToDate.
    Any advice on how the MDX could be better structured would be great, I can understand I'm calculating members, then adding them to my query, it just seems I should be calculating them in the SELECT based on a filter.  Output just needs to be
    [MTD]: single sum of Has Response to the current todate for that month
    [RangeHasResponse]:Sum of the entire range
    [Has Response] : sum on the last day, this isn't necessary, I'm just curious to see how that would tie into a filter, if it ruins the above leave it out.
    WITH
    SET [ToDate]=[Date].[Year - Quarter - Month - Date].[Date].&[2014-02-22T00:00:00]
    SET [DateRange] =
    [Date].[Year - Quarter - Month - Date].[Date].&[2014-01-01T00:00:00]:
    [ToDate].item(0)
    MEMBER [Measures].[MTD] AS
    SUM(MTD([Date].[Year - Quarter - Month - Date].CurrentMember),[Measures].[Has Response])
    MEMBER [Measures].[RangeHasResponse] AS
    SUM([DateRange],[Measures].[Has Response])
    SELECT
    {[Measures].[MTD],[Measures].[Has Response],[Measures].[RangeHasResponse] } on columns
    ,[ToDate] on rows
    FROM
    [ISD Prototype]
    Thanks
    Best Wishes, The Redman; If something helps, please help show it by voting, if it solves, bonus!

    Hi GGoldspink,
    In MDX, the CREATE MEMBER statement defines calculated members that are available throughout the session, and therefore, can be used in multiple queries during the session. So if the members can will be used in multiple times in SELECT clause, we can create
    a calculated member, and then use this members on SELECT clause which will improve the query performance.
    In your scenario, are there any performance issue in your MDX query? In this case, I'd suggest you enable SQL Sever profiler to monitor the queries, and check which part in the query took a very long time to run. Here is a useful link for your reference.
    http://sqlmag.com/database-performance-tuning/using-sql-profiler-tune-mdx-queries
    Besides, here is a document which will help you understand where issues can occur in your existing MDX code that will prevent you from experiencing the performance improvements, and provide advice on how to avoid these issues in your new MDX coding.
    http://technet.microsoft.com/en-us/library/bb934106(v=sql.105).aspx
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here
    Charlie Liao
    TechNet Community Support

  • File Count with selected date range

    Hi,
    Our requirement is to get the file count with selected date by the user from two sharepoint date time controls i.e. dtp1 and dtp2 into the data table. I am able to get the file count of specific folder from Pages library through below code. Now need to get
    the selected date range from two date time picker controls and check with the item created by is within the date range. If yes I need to get the file count.
    So please share your ideas/thoughts to do the same.
    SPList list =
    wikiweb.Lists["Pages"];
                        SPFolderCollection oFolders
    = list.RootFolder.SubFolders["foldername"].SubFolders;
                        DataTable dt
    = new DataTable();
                        dt.Columns.Add("Column1");
                        DataRow dr;
                        if (oFolders.Count
    > 0)
                            foreach (SPFolder oFolder in oFolders)
     if (!oFolder.Name.Equals("Forms"))
                                    dr
    = dt.NewRow(); 
    dr["Column1"] = oFolder.ItemCount.ToString();
    dt.Rows.Add(dr);
    Regards,
    Sudheer
    Thanks & Regards, Sudheer

    Hi,
    I have modified the code as below
    if((DateTime)(oFolder.Item.File.TimeCreated>dtFromDate.SelectedDate)&&(DateTime)(oFolder.Item.File.TimeCreated<dtToDate.SelectedDate))
    But still it is throwing the error.
    Please share your ideas on the same.
    Regards,
    Sudheer
    Thanks & Regards, Sudheer

  • Difficulty working with overlapping date ranges and sums

    I have data like the following and need help querying it for a specific result:
    startdate             enddate               place     class       number
    03-30-2006          04-18-2006          A             22           2000
    04-01-2006          04-30-2006          A             22           6000
    03-30-2006          04-15-2006          B             11           1700
    03-15-2006          04-12-2006          B             11           2900
    I'd like to return the sum of the averages for any given day, by place, and by class, like this:
    day                    place     class       average
    03-15-2006          B             11           100
    03-16-2006          B             11           100
    03-30-2006          A             22           100
    03-30-2006          B             11           200
    03-31-2006          A             22           100
    03-31-2006          B             11           200
    04-1-2006            A             22           300
    04-01-2006          B             11           200
    04-30-2006          A             11           200
    I'm stuck, any help would be GREATLY appreciated.

    307b218a-cebe-46f1-87b6-946b4076ce79 wrote:
    Here is what I said in my original post:
    I'd like to return the sum of the averages for any given day, by place, and by class.....Then gave an example of output.
    I think that sentence describes the relations perfectly succinctly.
    How can it, when there's no SUM involved
    307b218a-cebe-46f1-87b6-946b4076ce79 wrote:
    For the date of 3-30-2006, the sum of the averages for region A in class 22 is 100, since from 3-30-2006 to 4-18-2006 is 20 days, and 2000/20 = 100, and there are no other class 22's in place A in that date range. Same goes for 3-31-20006.
    However for 4-1-2006 the sum of the averages is 300, since I have one record who's average is 100 (2000/20), and another (6000/30 = 200) and 200 + 100 = 300.
    For 4/30, I have one average in that range for place A class 22, and its average for that period is 200.
    Does that help?
    Much better, thank-you ..
    try this:
    WITH data AS (
          SELECT TO_DATE('03-30-2006','mm-dd-yyyy') startdate, TO_DATE('04-18-2006','mm-dd-yyyy') enddate, 'A' place, 22 class, 2000 cnumber FROM DUAL UNION ALL
          SELECT TO_DATE('04-01-2006','mm-dd-yyyy') startdate, TO_DATE('04-30-2006','mm-dd-yyyy') enddate, 'A' place, 22 class, 6000 cnumber FROM DUAL UNION ALL
          SELECT TO_DATE('03-30-2006','mm-dd-yyyy') startdate, TO_DATE('04-15-2006','mm-dd-yyyy') enddate, 'B' place, 11 class, 1700 cnumber FROM DUAL UNION ALL
          SELECT TO_DATE('03-15-2006','mm-dd-yyyy') startdate, TO_DATE('04-12-2006','mm-dd-yyyy') enddate, 'B' place, 11 class, 2900 cnumber FROM DUAL ),
       data2 AS ( SELECT startdate, enddate, enddate-startdate+1 numdays, place, class, cnumber
                   FROM data d
    SELECT startdate+x.lvl day, place, class, cnumber/numdays avg
      FROM data2 d,
          ( SELECT level lvl FROM dual CONNECT BY level <= 10000 ) x
    WHERE x.lvl <= numdays
    ORDER BY d.startdate, x.lvl
    It helps to be specific and detailed

  • Need Help on using CAS Incremental Crawl with JDBC data source

    Hi,
    As part of one of the e-commerce implementations, we are implementing a delta pipeline which reads the data from the database views. We plan to crawl the data with the help of CAS JDBC data source. In order to optimize the data reads, we want to use the CAS capabilities of incremental crawl. We rely on CAS to be able to identify the updates available in the subsequent incremental crawl and only read the updated data for any given crawl unless we force a full crawl.
         We have tried implementing the above setup using JDBC data source. CAS reads from the database and stores it in the record store. The Full crawl works fine however; we observed some unexpected behavior during the incremental crawl run. Even when there is no change in the database, crawl metrics show that certain number of records have been updated in the record store and the number of updates differ in every subsequent run.
    Any pointers what can be the issue ? Does CAS has the incremental crawl capability using JDBC data source ?
    Regards,
    Nitin Malhotra

    Hi Ravi,
    Generic Extraction is used to extract data from COPA tables. And delta method used to extract delta records (records created after initilization) is timestamp.
    What is this timestamp?
    Assume that, you have posted 10 records one after the other to the COPA tables. And we do initilization to move all these 10 records to BW system. Later another 5 records are added to COPA tables. How do you think the system identifies these new 5 records (delta records).?
    It identifies based on a timestamp field (eg : Document created on ,a 16 digit decimal field).
    Assume that, in our previous initilzation, say  "document created on" field for the last (or the latest) record is 14/11/2006, 18.00 hrs. and  timestamp is set to the 14/11/2006, 18.00hrs.  then when you do delta update, the system treats all the records with "document created on" field is greater than 14/11/2006, 18.00 hrs as delta records. This is how new 5 records are extracted to bw system and timestamp is again set to the new value besed in field in the records.(say 14/11/2006, 20.00hrs)
    Assume that, you have two records with "document created on" field as 14/11/2006, 17.55hrs and 14/11/2006, 17.57hrs. and they were updated to the COPA table after 14/11/2006,20.00hrs (at this time last delta load is done)  due to some reason. How can you bring these two records? For this, purpose we can reset the timestamp at KEB5. In this eg, we can reset as 14/11/2006, 17.50 hrs) and do the delta again. So, the system picks all the records which are posted after 14/11/2006,17.50hrs again.  But remember that, doing this, you sending some of the records again (duplicate records). So, make sure that you sending ODS object. otherwise you end up with inconsistant data due to duplicate records.
    Hope this helps!!
    Vj

  • Using Dense/Sparse Lookup on Tables or files from different Databases

    Hi,
    I have a Subject Area which is built on Essbase cube. I have a requirment where I have to use a Lookup on Flat file and/or Database Table.
    I followed below steps
    1. Created a Logical Column in BMM Layer for a cube dimension
    2. Opened the LTS Properties --> Column Mapping and gave below formula
    Lookup(SPARSE "Function1"."E:\502125500".""."Function2.txt"."ALIAS", 'NA', "TNWD06613.genpitfi01.og.ge.com"."GOGREP".""."GOGREP"."Gen5,Functions" )
    where
    Function1"."E:\502125500".""."Function2.txt"."ALIAS" ---> Column from File (Created File DSN and imported in RPD)
    "TNWD06613.genpitfi01.og.ge.com"."GOGREP" ---> Essbase Cube
    3. Dragged the Column to Presentation for Subject Area on Cube
    When I try to create a report on this column I get below error.
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 16001] ODBC error state: 22005 code: -3030 message: [Microsoft][ODBC Text Driver] Expression too complex. [nQSError: 16015] SQL statement execution failed. (HY000)
    SQL Issued: SELECT 0 s_0, "Essbase Test"."Functions"."Alias" s_1, "Essbase Test"."Functions"."Gen5,Functions" s_2, SORTKEY("Essbase Test"."Functions"."Gen5,Functions") s_3 FROM "Essbase Test" FETCH FIRST 65001 ROWS ONLY
    Can anybody help me on the same?

    You can script schemas from all DBs and in case of conflicts you will have to decide what to do.
    For example if you have the same SP or UDF on two DBs that does different things, you need to decide what to do with them.
    Only if the conflict is tables with the same structure and without KEY constraints and you can also script data and go on.
    If you have PK-FK relationships (which I bet is the case) you really need to design your changes based on them and I suspect you will end up scripting instead of putting boxes on SSIS.
    It really is a migration job for an experienced DBA and am afraid SSIS can do that much as
    Integrate.. not Migrate.

  • How to use Db Provider Factories with System.Data.SqlServerCe

    I'm using SQL Server Compact Edition, but in the future I would like to be able to switch to another SQL Server Edition or even a different database. To achieve this, Microsoft recommends using DB Provider Factories (see: Writing Provider Independent Code in ADO.NET, http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=674426&SiteID=1).
    I enumerated the available data providers on my PC with:
    Code Snippet
    System.Reflection.Assembly[] myAssemblies = System.Threading.Thread.GetDomain().GetAssemblies();
    The important entry is:
    "SQL Server CE Data Provider"
    ".NET Framework Data Provider for Microsoft SQL Server 2005 Mobile Edition"
    "Microsoft.SqlServerCe.Client"
    "Microsoft.SqlServerCe.Client.SqlCeClientFactory, Microsoft.SqlServerCe.Client, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
    When executing:
    Code SnippetdataFactory = DbProviderFactories.GetFactory("System.Data.SqlServerCe");
    I got at first this error run time message:
    Failed to find or load the registered .Net Framework Data Provider.
    I added a reference to "Microsoft.SqlServerCe.Client" at C:\Programme\Microsoft Visual Studio 8\Common7\IDE\Microsoft.SqlServerCe.Client.dll and the program runs.
    Of course, it uses "Microsoft.SqlServerCe.Client" instead of "System.Data.SqlServerCe". Laxmi Narsimha Rao ORUGANTI from Microsoft writes in the post  "SSev and Enterprise Library" that "Microsoft.SqlServerCe.Client" is not meant to be used and that we should add the following entry to the machine.config file:
    Code Snippet<add name="SQL Server Everywhere Edition Data Provider" invariant="System.Data.SqlServerCe" description=".NET Framework Data Provider for Microsoft SQL Server Everywhere Edition" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    After changing the code to:
    Code Snippet
    dataFactory = DbProviderFactories.GetFactory("Microsoft.SqlServerCe.Client");
    I get the same error message as before, even after adding a reference to "System.Data.SqlServerCe"  at C:\Programme\Microsoft Visual Studio 8\Common7\IDE\System.Data.SqlServerCe.dll.
    Any suggestion what I should do ? Just use "Microsoft.SqlServerCe.Client" ? Anyway, I don’t like the idea that I have to change the machine.config file, since I want to use click once deployment.

    It seems there is no DbProviderFactory for System.Data.SqlServerCe. At least I couldn’t find one, no matter how hard I searched on the Internet. I only found Microsoft.SqlServerCe.Client.SqlCeClientFactory. But we are not supposed to use Microsoft.SqlServerCe.Client and the 2 classes do have quiet some differences among their members. So I decided to write my own factory:
    Code Snippet
    public class SqlCeClientFactory: DbProviderFactory {
    public static readonly SqlCeClientFactory Instance = new SqlCeClientFactory();
    public override DbCommand CreateCommand() {
    return new SqlCeCommand();
    public override DbCommandBuilder CreateCommandBuilder() {
    return new SqlCeCommandBuilder();
    public override DbConnection CreateConnection() {
    return new SqlCeConnection();
    public override DbDataAdapter CreateDataAdapter() {
    return new SqlCeDataAdapter();
    public override DbParameter CreateParameter() {
    return new SqlCeParameter();
    That was easy enough, right ? I spent 1 week investigating the problem, 10 minutes solving it. I wonder why Microsoft didn’t include this class, because they have already the code in Microsoft.SqlServerCe.Client. I guess they have their reasons, but of course, they don’t tell us. After wasting one more month, I probably can tell. Oh, how I hate this.
    Or has anyone an idea what might be the problem ?

  • How to use the JE database with other data types than byte arrays?

    Hi! I searched the javadoc of Berkley DB JE, for a way to introduce entry (but I need also retrieve) data with other type than byte arrays, e.g. String, or anything else, as int may be, etc.
    Still, I didn't find any such way, because the main (only?!) method to entry data into an open database - according what I found in javadoc - is:
    "public OperationStatus put(Transaction txn, DatabaseEntry key, DatabaseEntry data) throws DatabaseException"
    and both this and the corresponding method for retrieves, are based on the same DatabaseEntry type, which allow only entry data on byte[] support.
    What if I need to use Strings or int, or even char? I must do a special conversion from these types, to byte[], to use the database?
    Thank you!

    On the doc page (this is also in the download package),
    http://download.oracle.com/docs/cd/E17277_02/html/index.html
    see:
    Getting Started Guide
    Java Collections Tutorial
    Direct Persistence Layer (DPL)
    All of these describe how to use data types other than byte arrays.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Using Oracle EM 11g with Active Data Guard 11g

    Has anyone installed Active Data Guard 11g with OEM 11g for an active-active state or know if there are any installation procedures with these two products? We will be installing these products this year. Thanks, Cathy

    If you already have both servers configured in Grid Control as targets, it should be fairly easy to create a standby database on server B. OEM has Availability tab on your primary database Instance section should have "Data Guard" section which has "Setup and Manage" option. You follow through the wizard, and it will generate a standby database on server B. Then you can convert your standby db on server B to Active Read-only database by clicking few more buttons.
    If you do not have these two servers configured on your Grid Control, that would be the first task.
    We set up three standby databases using Grid Control 11g in our test boxes, and they worked very well. Our biggest problem was to actually installing the Grid Control, but once installed, everything was easy.

Maybe you are looking for