Items sold for January 2010 query

Hi Experts,
I need to create a query for a client that want to see all the Item Codes, Item Description, On hand quantity (at this point in time) and the Quantity on Invoices for a specific month. (Quantity only on AR Invoices, not Credit memos)
Here is what I did so far, but the 'January 2010 QTY' is the whole quantity and not just January's. Any help would be appreciated.
SELECT T0.[ItemCode], T0.[ItemName], T0.[OnHand], SUM(T1.[Quantity]) as 'January 2010 QTY'
FROM [dbo].[OITM]  T0 INNER JOIN INV1 T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OINV T2 ON T1.DocEntry = T2.DocEntry
GROUP BY T0.[ItemCode], T0.[ItemName], T0.[OnHand]
Marli

HI Marli,
Try below query for monthly analysis :
Declare @Year Numeric
Set @Year='2010'
SELECT @Year,T0.[ItemCode], T0.[ItemName], T0.[OnHand],
          sum(Case DATENAME(month,T2.DocDate) when 'January' then T1.Quantity   else 0 end) as [January Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'February' then T1.Quantity   else 0 end) as [February Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'March' then T1.Quantity   else 0 end) as [March Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'April' then T1.Quantity   else 0 end) as [April Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'May' then T1.Quantity   else 0 end) as [May Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'June' then T1.Quantity   else 0 end) as [June Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'July' then T1.Quantity   else 0 end) as [July Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'September' then T1.Quantity   else 0 end) as [September Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'October' then T1.Quantity   else 0 end) as [October Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'November' then T1.Quantity   else 0 end) as [November Qty],
          sum(Case DATENAME(month,T2.DocDate) when 'December' then T1.Quantity   else 0 end) as [December Qty]
FROM [dbo].[OITM]  T0
      INNER JOIN INV1 T1 ON T0.ItemCode = T1.ItemCode
      INNER JOIN OINV T2 ON T1.DocEntry = T2.DocEntry
WHERE DATENAME(YEAR ,T1.DocDate )=@Year
GROUP BY DATENAME(month,T1.DocDate ),T0.[ItemCode], T0.[ItemName], T0.[OnHand]
Change @year=2010 to 2011 or 2009.It will show the analysis for particular year set.
Thanks,
Neetu

Similar Messages

  • Is It possible for a Non Shippable Inventory Item sold in OM update INVENTORY Levels

    Is It possible for a Non Shippable Inventory Item sold in OM update INVENTORY Levels?
    I have created an Item which is inventory tracked but not shippable. Customer & Internally Ordered. But upon booking the Sales Order, the INVENTORY level of the said item does not get updated with the sale.
    How can i make it update INVENTORY without going thru shipping module?
    thanks.

    Hi Jay
    How are you.
    Yes, in process sampling only.
    Is it not neccessary to have a wip validity rule for wip products in the specs. I am able to create samples for wip products with inventory validity rule.
    Regards
    Prem.

  • Please Help! I need a report: Total Items sold from each Supplier.

    Dear experts
    I would like to build a Query\Report that will show the TOTAL amount of items sold (in invoices) from each supplier.
    This is not possible in the reports section, because it is not your regular Salles per cards\items report.
    I want the report to show a sum per line. meaning:
    I have totally sold from Supplier:'XYZ'  5,123 items (no matter which ones) at a total of 75,540$
    I would like the report to show ALL suppliers , thus the reason i want it to show 1 supplier-per line.
    I couldnt figure out how to write this Query and if its even possible to make a 'sum per line' report. (like the ones that you output with default report section).
    Personally , I found it really odd that it is not in the default reports option, It is higly common for organization to check Who is its Top supplier (in sales) in order to decied how to continue doing buisness with him.
    Could any of you experts assist me in writing this Supplier-Sales-Report?
    Thank you in advanced,
    D.Medalion

    Hi Medalion,
    Have you tried using sales analysis reports. Yyou can view items sold to particular customer in that report too. You need to click on items-->tick individual display and tick group by customers. This would give your desired format. Is there anyrhing else that you are looking for ??
    You may also check these to get an idea;
    Re: Query for top 5 items/customers
    Query for top 5 items
    This would require s user id and pass word
    https://websmp205.sap-ag.de/~sapidb/011000358700001172792006E
    Thanks,
    Joseph
    Edited by: Joseph Antony on Aug 6, 2010 11:19 AM

  • Populate Multiple Items bundled in a single query

    Hello,
    I am trying to create a report in which I have mulitple items that I want to populate. All of these use the same query but use different rows in the query to populate themselves. My question is:-
    Is there a way to bundle the item assignment into a single query and populate the items from there? I want to reduce the time it takes for me to display the report and just hit the database once instead.

    Hi there,
    when u say report, i think its a more of a page showing few items on a region whose values are populated from Database rather than a SQL report which will not have any items. Is that correct?
    yes, multiple items of a page can be assigned values at once.
    assume: P1_ITEM1,P1_ITEM2,P1_ITEM3,P1_ITEM4 are different items on a page, an "On-Load Before Header" PL/SQL process can be created to assign values to the items in this way:
    SELECT tab.col1,tab.col2,tab.col3,tab.col4 INTO :P1_ITEM1,:P1_ITEM2,:P1_ITEM3,:P1_ITEM4 FROM TABLE tab;
    Item "Source Used" should be of type: Only When Current Value in session state is null
    Source Type: PL/SQL Expression or function
    and Source Value or EXpression should be some thing like this :P1_ITEM1
    Hope this helps.
    Edited by: Chaitu_Apex on Mar 10, 2010 2:43 PM

  • How get Mailbox Folder Item Count for date range?

    How to make query to Exchange 2013 like this:
    query ItemCount (specified Mailbox, specified Folder (with subfolders), specified Date Range)?
    I find this script for Exchange 2010: http://gsexdev.blogspot.ru/2012/10/item-age-sample-one-reporting-on-item.html
    This script dont work for Exchange 2013 ((

    I believe you are making the change on both the places in code, as this path version would be different in 2013
    C:\Program Files\Microsoft\Exchange\Web Services\1.2\Microsoft.Exchange.WebServices.dll"
    Cheers,
    Gulab Prasad
    Technology Consultant
    Blog:
    http://www.exchangeranger.com    Twitter:
      LinkedIn:
       Check out CodeTwo’s tools for Exchange admins
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • Items Sold Report

    We would like to create a report that shows how many items we have sold and percentage of each size sold in a specific color combination.
    We are a clothing company so ideally this report can be in a matrix format for a particular style -- showing the colors on vertical axis and sizes on the horizontal axis. 
    Within each color / size cross section (cell) would be the # of pieces sold and % sold in that size for that color. 
    I'm not sure if SAP will allow a report like this to be built.  If not, is there any way we can generate a query that has this type of information but just not in the matrix format?
    So, we would see the following:
    Item Code...Units Sold...% Of That Size Sold For Each Style/Color Combination
    For example --
    0737BKSMALL....20....15% (this is the percent of size small that has been sold in Black)
    Any ideas?
    Thanks,
    Mike

    Hi,
    What I mean by "% Of That Size Sold For Each Style/Color Combination" is this.  Let's say we have a style of shirt available in 3 colors: Navy, White, Black.  There are a total of 100 Navy pieces sold.  However, only 10 of those sold are in size Small and sizes for each color range from S-L.  So, 10% would be the "% Of That Size Sold For That Style In The Color Navy. 
    Our item codes are all defined in the following way -- they are 9 characters in length.
    The first 4 characters define the style.  The next 2 charcters define the color.  The last 3 characters define the size.
    So, in writing this Query, I was wondering if there was any way that for the last column of info (% Of That Size Sold For Each Style/Color Combination), it could somehow add up the total pieces sold for the first 6 characters in the Item Code that match.  That would give the total sold in the Style/Color combination.  This number would then be used as the denominator for all Item Codes with the same first 6 characters.   
    Make sense?
    Thanks,
    Mike

  • How to display the field name in the tabulated view for a content query web part

    I have added a content query web part changed the web part file to include custom columns imported and reffered itemstyle.xsl
    to include the tabulated view for the content query.
    However the way it is displayed is such that only the content is displayed.
    As i am using a tabular view wto display the data, i want to display their field names as well.

    Hi  ,
    According to your description, my understanding is that you need to display the field in the tabulated view for a content query web part.
    For your issue, please refer to the code as below:
    <xsl:template name="VendorCustomStyle" match="Row[@Style='VendorCustomStyle']" mode="itemstyle">
    <html>
    <table width="100%">
    <xsl:if test="count(preceding-sibling::*)=0">
    <tr>
    <td width="8%" valign="top"><div class="item"><b>Vendor ID</b></div></td>
    <td width="12%" valign="top"><div class="item"><b>Vendor Name</b></div></td>
    <td width="50%" valign="top"><div class="item"><b>Vendor Description</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Vendor Country</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Vendor Date</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Created By</b></div></td>
    </tr>
    </xsl:if>
    <tr>
    <td width="8%" valign="top"><div class="item"><xsl:value-of select="@VendorID" /></div></td>
    <td width="12%" valign="top"><div class="item"><xsl:value-of select="@Title" /></div></td>
    <td width="50%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Description" disable-output-escaping="yes" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Country" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Date" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Author" /></div></td>
    </tr>
    </table>
    </html>
    </xsl:template>
    For more information, please have a look at the blog:
    http://www.codeproject.com/Articles/756834/Customizing-the-Content-Query-Web-Part-and-Item-St
    http://msdn.microsoft.com/en-us/library/ms497457.aspx
    http://clarksteveb.hubpages.com/hub/Customized-Content-Query-Web-Part-CQWP-in-SharePoint-2007-with-results-Tabbed-Grouped-and-in-an-HTML-Table
    http://blog.sharepointexperience.com/customitemstyle/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Problem getting CR for VS 2010 to work

    I just downloaded and installed CR for VS 2010, the file is "CRforVS_13_0_1.exe".  It seemed to install just fine.  But I can't get it to work in my VB .Net 2010 project. 
    I can select "Add a New Item" and then select "Crystal Report", no problem.
    When the new report window appears, it defaults to "Using the report wizard", if I click OK, it locks up VS and I have to use the task manager to close VB.
    If I select "As a Blank Report" it's ok and will add a blank report.
    But as soon as I select the Database Expert it throws an error saying "External component has thrown an exception" and then VB is locked up.
    I have Win7 64bit home premium OS.
    I have VS 2005 and VS 2010 installed
    CR in the VS 2005 is working fine.
    I had a simular problem last november and the response I got was there was I bug in CR when a machine has bot VS 2005 and VS 2010 and it was going to be fixed when the SP came out.
    So, it there a SP in need to download and install?  Do I need to manually add some references to my project (not sure what references are required).
    Any information or suggestions will be appriciated, Thanks

    Hi Ed,
    Yup I know... The problem is Windows used to use the c:\temp and now it users the temp folders located under the c:\User\ folder structure.
    CR uses a wild card \temp to save the temp files we generate. The problem is with the wild cards. The issue now is you should not be using a c:\temp folder according to Windows Rules all temp files should go under the users folder structure.
    I actually do the same thing at home and ran into a problem with Logitech's installer, it would complete the install if I set my environment variable to c:\temp. As soon as I changed it back to the Windows 7 default the installer ran fine.
    So even though you have been using it for 20 years, and so have I, we have to change to follow the new OS rules. Using any other name like \MyTemp is fine as I first indicated.
    Thanks again
    Don

  • How to force Portal not to display item content for a custom item

    Hi,
    I've read in several places questions about rendering an Item in a custom way, without letting portal
    display the item content, if you read along I've discovered a SIMPLE WAY to force portal not to
    display the content item.
    As per bugs and requests on metalink it seemed that in many versions of Oracle Portal (mine is 9.0.4.1)
    this is impossible, since even if we remove the "Item Content" from the list of displayed attributes in the
    region, Portal does display it anyway, just after every other Attribute.
    - Re: using an item type procedure
    - Metalink BUG # 3998251 "ENH: SHOULD BE ABLE TO HIDE "ITEM CONTENT" FOR TEXT ITEMS OR NEED A NEW ITEM TYP" and is being looked into internally whether it is feasible to include this in future releases.
    - Metalink Doc ID:      Note:290534.1          Subject:      Unable to Hide the "Item Content" Attribute for a Text Item     
    Mine scenario was the usual one:
    -oracle portal 9.4.0.1
    -a custom item based on custom text (so as to have the RTE to edit HTML).
    -A few attributes that help me define the class of an enclosing DIV tag that I wanted to put (a class and an ID)
    -A plsql call associated to the custom item, with the flag "display inline" checked
    -The dirty HTML generated by the built-in Oracle RTE (with BODY and HTML tags enclosing the actual HTML)
    -The region that will contain the item is set so that just the "Function Call" is (or should be) displayed
    I wanted to control entirely the display of the item text, while enclosing it in a custom DIV tag.
    After a few tries, one of which involved forcing an HTML comment around the item content that Portal stubbornly
    displayed, I've discovered this simple way. I don't know hom much this way is portable, but is done entirely with the APIs.
    In the stored procedure that displays the item, that I encolose, i just do:
    1) retrieved the ITEM querying WWSBR_ALL_ITEMS;
    2) updated the ITEM via WWSBR_API.MODIFY_ITEM, passing as display_otpion the value WWSBR_API.FULL_SCREEN!!
    Here I try a little explanation:
    An item just created has FULLSCREEN=1 and INPLACE=0. This way the stored procedure is executed
    AND the item content is displayed.
    WIth the modify_item, the item gets FULLSCREEN=1 and INPLACE=2 !! This seems strange since the docs
    tells that inplace can be 0 or 1. But this works.
    I've played with the WWV_THINGS table directlry, and setting INPLACE to 0, 2 or 3 works as well, while
    if it is set to 1, it behave the usual way.
    The trick is to have FULLSCREEN to 1 while INPLACE is not set to 1.. and this was the easiest solution.
    I'd like to receive a feedback from Oracle regarding this behaviour.
    Bye
    Walter
    --- This is the procedure ---
    CREATE OR REPLACE PROCEDURE show_item_mod(itemid in varchar2, styleid in varchar2,
         styleclass in varchar2) IS
    html CLOB;
    idx1 number;
    idx2 number := 0;
    item portal.wwsbr_all_items%rowtype;
    BEGIN
         --retrieve item content
         select * into item from portal.wwsbr_all_items where id=itemid;
         html := item.text;
         --check if text body contains "dirty" tags as put by Oracle RTE editor
         --and strips text from <BODY> to </BODY>
         idx1 := instr(html,'<BODY>');
         if(idx1 > 0) then
                   --strip text of broken tags
                   idx2 := instr(html,'</BODY>');
                   html := substr(html,idx1+6,idx2-idx1-6);
         end if;
         --check if this is first time we enter this procedure
         --or if text has changed
         if(item.description is null or idx2 != 0) then
                   --update filename so next time we won't enter the IF branch
                   --update DIPLSAY OPTION to FUllSCREEN
                   --update text, if this was changed
                   idx1 := portal.wwsbr_api.modify_item(
                        p_master_item_id => item.masterid,
    p_item_id => itemid,
    p_caid => item.caid,
    p_folder_id => item.folder_id,
    p_display_name => item.display_name,
    p_region_id => item.folder_region_id,
    p_display_option => portal.WWSBR_API.FULL_SCREEN,
    p_category_id => item.category_id,
    p_category_caid => item.category_caid,
    p_author => item.author,
    --p_description => item.description  ,
    p_keywords => item.keywords ,
    p_text => html ,
    p_folderlink_id => item.folder_link_id ,
    p_folderlink_caid => item.folder_link_caid ,
    p_publish_date => item.publish_date ,
    p_expire_mode => item.expiremode,
    --p_file_filename => 'Changed!',
                        p_description=> 'changed!',
    p_addnewversion => FALSE,
    p_access_level => portal.wwsbr_api.FOLDER_ACCESS
                   -- process cache invalidation messages
              portal.wwpro_api_invalidation.execute_cache_invalidation;
              end if;
         htp.prn('<div ');
         if(styleclass is not null) then
                   htp.prn(' class="' || styleclass || '" ');
         end if;
         if(styleid is not null) then
                   htp.prn(' id="' || styleid || '" ');
         end if;
         htp.prn('>');
         htp.p(html);
         htp.p('</div>');
    END show_item_mod;
    /

    Hi,
    I've read in several places questions about rendering an Item in a custom way, without letting portal
    display the item content, if you read along I've discovered a SIMPLE WAY to force portal not to
    display the content item.
    As per bugs and requests on metalink it seemed that in many versions of Oracle Portal (mine is 9.0.4.1)
    this is impossible, since even if we remove the "Item Content" from the list of displayed attributes in the
    region, Portal does display it anyway, just after every other Attribute.
    - Re: using an item type procedure
    - Metalink BUG # 3998251 "ENH: SHOULD BE ABLE TO HIDE "ITEM CONTENT" FOR TEXT ITEMS OR NEED A NEW ITEM TYP" and is being looked into internally whether it is feasible to include this in future releases.
    - Metalink Doc ID:      Note:290534.1          Subject:      Unable to Hide the "Item Content" Attribute for a Text Item     
    Mine scenario was the usual one:
    -oracle portal 9.4.0.1
    -a custom item based on custom text (so as to have the RTE to edit HTML).
    -A few attributes that help me define the class of an enclosing DIV tag that I wanted to put (a class and an ID)
    -A plsql call associated to the custom item, with the flag "display inline" checked
    -The dirty HTML generated by the built-in Oracle RTE (with BODY and HTML tags enclosing the actual HTML)
    -The region that will contain the item is set so that just the "Function Call" is (or should be) displayed
    I wanted to control entirely the display of the item text, while enclosing it in a custom DIV tag.
    After a few tries, one of which involved forcing an HTML comment around the item content that Portal stubbornly
    displayed, I've discovered this simple way. I don't know hom much this way is portable, but is done entirely with the APIs.
    In the stored procedure that displays the item, that I encolose, i just do:
    1) retrieved the ITEM querying WWSBR_ALL_ITEMS;
    2) updated the ITEM via WWSBR_API.MODIFY_ITEM, passing as display_otpion the value WWSBR_API.FULL_SCREEN!!
    Here I try a little explanation:
    An item just created has FULLSCREEN=1 and INPLACE=0. This way the stored procedure is executed
    AND the item content is displayed.
    WIth the modify_item, the item gets FULLSCREEN=1 and INPLACE=2 !! This seems strange since the docs
    tells that inplace can be 0 or 1. But this works.
    I've played with the WWV_THINGS table directlry, and setting INPLACE to 0, 2 or 3 works as well, while
    if it is set to 1, it behave the usual way.
    The trick is to have FULLSCREEN to 1 while INPLACE is not set to 1.. and this was the easiest solution.
    I'd like to receive a feedback from Oracle regarding this behaviour.
    Bye
    Walter
    --- This is the procedure ---
    CREATE OR REPLACE PROCEDURE show_item_mod(itemid in varchar2, styleid in varchar2,
         styleclass in varchar2) IS
    html CLOB;
    idx1 number;
    idx2 number := 0;
    item portal.wwsbr_all_items%rowtype;
    BEGIN
         --retrieve item content
         select * into item from portal.wwsbr_all_items where id=itemid;
         html := item.text;
         --check if text body contains "dirty" tags as put by Oracle RTE editor
         --and strips text from <BODY> to </BODY>
         idx1 := instr(html,'<BODY>');
         if(idx1 > 0) then
                   --strip text of broken tags
                   idx2 := instr(html,'</BODY>');
                   html := substr(html,idx1+6,idx2-idx1-6);
         end if;
         --check if this is first time we enter this procedure
         --or if text has changed
         if(item.description is null or idx2 != 0) then
                   --update filename so next time we won't enter the IF branch
                   --update DIPLSAY OPTION to FUllSCREEN
                   --update text, if this was changed
                   idx1 := portal.wwsbr_api.modify_item(
                        p_master_item_id => item.masterid,
    p_item_id => itemid,
    p_caid => item.caid,
    p_folder_id => item.folder_id,
    p_display_name => item.display_name,
    p_region_id => item.folder_region_id,
    p_display_option => portal.WWSBR_API.FULL_SCREEN,
    p_category_id => item.category_id,
    p_category_caid => item.category_caid,
    p_author => item.author,
    --p_description => item.description  ,
    p_keywords => item.keywords ,
    p_text => html ,
    p_folderlink_id => item.folder_link_id ,
    p_folderlink_caid => item.folder_link_caid ,
    p_publish_date => item.publish_date ,
    p_expire_mode => item.expiremode,
    --p_file_filename => 'Changed!',
                        p_description=> 'changed!',
    p_addnewversion => FALSE,
    p_access_level => portal.wwsbr_api.FOLDER_ACCESS
                   -- process cache invalidation messages
              portal.wwpro_api_invalidation.execute_cache_invalidation;
              end if;
         htp.prn('<div ');
         if(styleclass is not null) then
                   htp.prn(' class="' || styleclass || '" ');
         end if;
         if(styleid is not null) then
                   htp.prn(' id="' || styleid || '" ');
         end if;
         htp.prn('>');
         htp.p(html);
         htp.p('</div>');
    END show_item_mod;
    /

  • Different results for the same query and same data !  (oracle 9i)

    Hi,
    This is a mystery for me. I've got on my database exactly the same data that my customer (exported schema). We both launch the same query (generated by the software that we sold him). This query has a criteria IN (SELECT MAX()...) to get only data from the last year.
    The query gives 477 rows on my computer (correct answer), but no row on his! We have the same data! The only difference is the Oracle release : 9.2.0.6.0 for him, 9.2.0.1.0 for me.
    If he executes the subquery alone, it gives the expected result.
    If he replaces the MAX() in the subquery by the returned value (year 2016), he gets his 477 rows.
    I've rewritten the query with a NOT EXISTS, and now all is fine. (Less efficient but it works).
    I have no rational explication. Did I miss something ?
    Thanks for any answer.
    This is the query:
    SELECT ...
    FROM
    CRA, GRA, ...
    WHERE
    /* subselect */
    (CRA.COLLCOD, CRA.CRANEXE, CRA.CRANCODBUD, CRA.GRANNUM, CRA.CRANCOD1, CRA.CRANCOD2, CRA.CRANCOD3, CRA.CRANCOD4)
    IN (
    SELECT b.COLLCOD, MAX(cranexe), b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    FROM CRA b
    GROUP BY b.COLLCOD, b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    AND... /* other filters and joins */

    v9.2.0.1 was full of bugs. a lot of these bugs had to do with "incorrect results", typically associated with old stats or complex queries (certain types of subqueries were very likely to give wrong resutls, due to the way they were rewritten by the optimizer).
    apply the 9.2.0.6 patch set

  • Regarding nor of line items selected in per select query..

    hi,
    i want  to display nor of line items selected in per select query for two individual  queries which are linkesd by for all entries..
    regards..
    chetan

    Hi,
    I dont unserstand the problem you are facing. please paste your SELECT query and then explain the problem. then it will be easy for analysis.
    Basically DESCRIBE TABLE itab LINES n.  this statement will put the number of lines the internal table contains
    //Kothand

  • ERR-1002 Unable to find item ID for item

    I just started playing around with Apex 4.0.2 and I had a question which might be quite basic, so please bear with me.
    I created a report and a calendar which displays the same data (from a table) in different format. I want to create a link from the calendar to the report based on the data that is being displayed in the calendar to show more details about the calendar item. In the calendar page, I created a link under Column link and did the following:
    SET these items: P2_START_DATE
    With these values: 10-Dec-2010
    When I click on the link from the Calendar page, it gives me the following error:
    Error ERR-1002 Unable to find item ID for item "P2_START_DATE" in application "100"
    The Report attribute START_DATE does exist in the Page 2.
    How do I accomplish this ? Any help will be greatly appreciated.
    Thanks and Happy Holidays !

    Hi agopalan,
    Actually the use of "Px_" is just a convention - but a very good convention to follow. You could name that item P7_START_DATE, MY_START_DATE or any other valid name and ApEx will still know it belongs to page 2 - but please don't do that!
    You mention you have a report attribute START_DATE - do you mean a report column? If so, you can't set the START_DATE report column to a value - it isn't an item.
    If you want the report to show details based on the calendar link clicked:
    1) Create a hidden item called P2_START_DATE.
    2) Include :P2_START_DATE in the WHERE clause of your report's SQL in whatever way you need to limit the report rows.
    3) Keep your calendar link defined as-is.
    That should do it.
    Good luck with ApEx and Happy Holidays to you as well!
    John

  • Taskbar Jumplist anomalies for Word 2010 and Excel 2010

    I am having problems with missing jumplists for Office 2010 products (Word and Excel) pinned on the Windows 7 taskbar, **BUT** have no problems with jumplists for Notepad and IE pinned on the taskbar.
    Observation 1: I just upgraded from Office 2010 Starter to full Office 2010 by getting a product key. Full Office 2010 was installed on my laptop when I purchased it but only Starter was licensed. Full Office 2010 was unusable until the upgrade. I suspect
    the leapfrog from Starter to full Office 2010 might have a part in this jumplist issue.
    Observation 2: I can see from a DOS prompt that the AutomaticDestinations and CustomDestinations folders exist under Recent. However, from Windows Explorer I cannot see the 2 folders under Recent. (That may be a clue…if other people CAN see the 2 folders
    from Windows Explorer.)
    Observation 3: In DOS, I can see that both directories have files ending in -ms. I can also see updates (new files with fresh timestamps) from opening Word and Excel files in those 2 directories. It’s almost like Word and Excel don’t understand to go look
    in those 2 directories after the Office upgrade, even though Windows 7 (?) generates the -ms files for the jumplist function.
    Observation 4: Again, no problems with Notepad and IE jumplists. I can remove the files from the AutomaticDestinations folder and cause Notepad to have no jumplist items, and then restore them and Notepad has jumplist contents again.
    Observation 5:  I had no problem using jumplists with Word Starter and Excel Starter.  All references to Office/Word/Excel Starter are now gone from the Starter button and All Programs - sent to Recycle bin.  I deleted the Word Starter
    and Excel Starter entries when I upgraded, but I just deleted the Microsoft Office Starter (Englisgh) entry under All Programs today...I thought it was a benign entry and wouldn't hurt since I wasn't using it.  Maybe there's some corruption in registry
    as a result of the mixture.  Interestingly, I can drag a file created in Word Starter to the taskbar and it will try to pin it to the Word Starter taskbar "ghost" that's in the Recycle bin.
    Any clues anyone?  I have no large files in the two destination folders, and have only about 20 files total in each folder...far fewer than the 999 threshhold mentioned in one of the updates for Office 2010.
    Thank you!

    I encountered exactly the same problem, and under exactly the same circumstances as the original poster (upgraded from Office Starter to Home and Business; jump lists worked fine in Starter, then stopped working for Excel and Word after upgrading). 
    Like the original poster, none of the various fixes found online corrected the problem, nor did re-installing Office.
    I also tried what was suggested by Max Meng and created a new User Account. The problem occurred for the new account, just as it did with the old one.
    After about 6 hours of fighting, I have finally solved the problem.  The solution is not easy, fast or pretty.
    What I did was uninstall Office (again) using the Control Panel. Then I ran a FixIt utility found here:
    http://support.microsoft.com/kb/290301 (method 2)
    My hope was that this would do additional registry clean-up.  I knew from earlier attempts that this alone would not fix the problem, though.
    Despite uninstalling twice, there were still a lot of references left in the registry to "Word Starter" and "Excel Starter".  Likewise, there were still references to "WINWORDC.EXE" and "EXCELC.EXE", which are the starter versions of the executables.
    So I went through the registry using RegEdit, and manually deleted every key which included those strings.  The largest number of cases were file type definitions for various Word and Excel file extensions.  When in doubt, I deleted entire tag
    hierarchies for Word and Office file types, figuring that they would be restored when I reinstalled Office.  In the process, I removed pretty much every reference to Word or Excel that I could find in the registry.
    I also deleted any directory on my hard drive (in c:\Program Files(x86), c:\Program Data, and c:\Users\<name>\AppData which appeared to be related to Office.
    Having done this, I reinstalled again, and the jump lists for Word and Excel now work.
    In debugging the problem, I found that .automaticDestination-ms files (which contain the data behind the jump lists) were not being created when I opened Word or Excel documents; they *were* being created when I manually pinned individual files to the
    taskbar, however. 
    I suspect that this might be due to the long hexadecimal filename being based on a hash of the application name, or what the system thinks is the application name based on the file type.  Removing the references to "Word Starter" and "Excel Starter",
    and the corresponding WINWORDC.EXE and EXCELC.EXE in the registry might have cleared up this problem.
    Obviously this fix is potentially risky, and should only be attempted if you are comfortable editing the registry. Making a full system backup beforehand would be a wise precaution.  For this specific case, however (broken jump lists after
    upgrading from Starter to full Office) it would appear the only alternative is a clean install of Windows (to wipe the registry completely).

  • Partitioning For Optimal Parallel Query Execution

    Hi All,
    We are trying to design an architecture that benefits from partitioning and parallel query to obtain the best query response times for our system.
    Let me start by describing the main table which has five columns:
    Columns:
    1) DocId ------- Numeric Primary Key Constraint (Unique)
    2) Text ------- CLOB of XML Content
    3) SCode ------- Varchar 12 ( service code Can be one of 200 values)
    4) A_Date ------- Oracle Date ( The arrival date )
    5) A_Month ------- Numeric partition key, the month number (1-12)
    We insert 100,000 records daily so a month of data will contain 3,000,000 rows. The Text varies from 4k to 200k bytes and on average is around 30k bytes per document. A_Date is obtained when the C++ application receives a client connection. After document transmission is complete the DocId is obtained from an Oracle sequence. It is true that A_Date and DocId increase together. However because of varying document sizes and transmission rates, there is no guarantee that consistent order between the two columns exists.
    For Example: If time (t) increases and the connection times are: t1, t2, t3, t4 and the document at t2 took long to transmit, we can have:
    A_Date -------- DocId (From Oracle Sequence)
    t2 -------------- 1004
    t4 -------------- 1003
    t3 -------------- 1002
    t1 -------------- 1001
    A_Month is simply the month number (1-12) extracted from the transmission entry timestamp. It is also our Partition Key (see below). When the year wraps around from 2006 to 2007, data for January will simpy fall into the 1st partition bucket, and so on..
    QUERY NEEDS: Our queries are centered around a DateTime interval Where the left endpoint is current day/time. They can query the current day, current to 1 month back, current to 2 months back, .. current to 15 months back. We MUST RETURN a list of DocId's sorted in DESCENDING ORDER for screen display purposes.
    In General we need to return sub-second for the 1st month. As we query further back in time longer response times between 1 and 4 seconds are acceptable.
    PARTITIONING AND INDEXES:
    The table is partitioned by A_Month as shown below:
    Create Table IndexTable
    PARTITION BY RANGE (A_Month)
    ( PARTITION p1 VALUES LESS THAN 1.1 ...
    PARTITION p2 VALUES LESS THAN 2.1 ...
    PARTITION p3 vALUES LESS THAN 3.1 ...
    There are GLOBAL INDEXES on DocId, Text(Domain Index), and SCode.
    A_Date is a LOCAL INDEX.
    QUERY STRUCTURE:
    My Query structure looks like this (for a 2 month query):
    SELECT DocId from IndexTable WHERE
    Contains (Text, 'BUSH and EARNINGS') > 0 AND
    SCode in ('S1', 'S2', 'S3', 'S4') AND
    A_Date Between '2006-01-15 11:00:00' AND '2006-03-15 11:00:00'
    Order By DocId DESC;
    QUESTIONS (THERE ARE THREE)
    #### QUESTION 1 ####
    As I examine various explain plans, the PSTART and PSTOP do not reflect consistency with my A_Date range. It seems to always display:
    PStart PStop
    RowId RowId
    no matter what my A_Date range is.. I don't see it pruning my partitions. I cannot find documentation as to what RowId means or how it affects the optimizer's plan.
    #### QUESTION 2 ####
    I have tried parallelization hints on the table and indexes such as
    /*+ PARALLEL( IndexTable, 4) */ and on the A_Date index
    /*+ PARALLEL_INDEX( IndexTable, A_Date_Index, 4) */.
    I can't really tell if the parallel hints make a difference.
    However, the FIRST_ROWS hint makes a big difference if I nest the query inside a rownum clause as:
    SELECT * from
    ( Select /+* first_rows */ ... WHERE CONTAINS... > 0 AND... )
    Where ROWNUM <=20;
    #### QUESTION 3 ####
    I'm running close to the latest RedHat Linux and Oracle 10g2 and I have read about Parallel Slave Processes in Tom Kyte's Expert Oracle Architecture book in which he says you should see processes like:
    ora...p000..
    ora...p001..
    ora...pnnn..
    Which are the parallel slave processes. I have NEVER seen any oracle processes numbered as such running on my system when I run test queries. I have seen some q_ processes and others, but not the pnnn processes..
    Can I benefit from parallel query without ever seeing these processes??
    I Greatly Appreciate Any Advice To Any Of These Questions..
    Joe

    Well I can tell you this much. You will never get partition pruning if you don't have the partition key in the where clause.
    I'm not sure about the parallel query. There was a time that this wasn't supported with Text indexes, but not sure if that still applies today.
    In theory there are two levels of partitioning that can be defined that you may want to test out.
    1st, range partition the base table and create a partitioned text index based on that. This is what you are currently doing.
    2nd, in the storage preference for the $I table specify a range or hash partition (I've never tried this, but in theory it should work) on the token_text column. Try this out and see if it works.

  • Sending and receivind ADC coefficients from/to soundcard in VBA for Excel 2010

    How to send  and receive ADC coefficients from/to soundcard(mixer,microphone)     in VBA for Excel 2010   (noncom. edition, x64)   to Excel macros for DFT (from IDFT), IIR , user defined samples parser   (special
    noise generator, graphic s(t),S(jw), arg s(jw)    soundcard AFR test ) ?
    What .dll is need for this (without bass.dll)?

    Example from internet :
    'This project needs a module and a form
    'The form must contain two labels, two progressbars, a timer and a checkbox
    'Paste this code into the form
    Dim hmixer As Long ' mixer handle
    Dim inputVolCtrl As MIXERCONTROL ' waveout volume control
    Dim outputVolCtrl As MIXERCONTROL ' microphone volume control
    Dim rc As Long ' return code
    Dim ok As Boolean ' boolean return code
    Dim mxcd As MIXERCONTROLDETAILS ' control info
    Dim vol As MIXERCONTROLDETAILS_SIGNED ' control's signed value
    Dim volume As Long ' volume value
    Dim volHmem As Long ' handle to volume memory
    Private Sub Form_Load()
    Me.ScaleMode = vbTwips
    Me.Caption = "Volume meter"
    Label1.Move 0, 0
    Label1.AutoSize = True
    Label1.Caption = "Input level"
    Label2.Move 0, 4 * Label1.Height
    Label2.AutoSize = True
    Label2.Caption = "Output level"
    ProgressBar1.Move Label1.Width * 2, 0, 3375
    ProgressBar2.Move Label1.Width * 2, Label2.Top, 3375
    Check1.Move ProgressBar1.Left, ProgressBar1.Height
    Check1.Caption = "Get Input"
    Me.Move Me.Left, Me.Top, ProgressBar1.Width + ProgressBar1.Left + 10 * Screen.TwipsPerPixelX, ProgressBar2.Top + ProgressBar2.Height + 30 * Screen.TwipsPerPixelY
    Timer1.Interval = 50
    Timer1.Enabled = True
    ' Open the mixer specified by DEVICEID
    rc = mixerOpen(hmixer, DEVICEID, 0, 0, 0)
    If ((MMSYSERR_NOERROR &lt;&gt; rc)) Then
    MsgBox "Couldn't open the mixer."
    Exit Sub
    End If
    ' Get the input volume meter
    ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_DST_WAVEIN, MIXERCONTROL_CONTROLTYPE_PEAKMETER, inputVolCtrl)
    If (ok &lt;&gt; True) Then
    ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, MIXERCONTROL_CONTROLTYPE_PEAKMETER, inputVolCtrl)
    End If
    If (ok = True) Then
    ProgressBar1.Min = 0
    ProgressBar1.Max = inputVolCtrl.lMaximum
    Else
    ProgressBar1.Enabled = False
    MsgBox "Couldn't get wavein meter"
    End If
    ' Get the output volume meter
    ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT, MIXERCONTROL_CONTROLTYPE_PEAKMETER, outputVolCtrl)
    If (ok = True) Then
    ProgressBar2.Min = 0
    ProgressBar2.Max = outputVolCtrl.lMaximum
    Else
    ProgressBar2.Enabled = False
    MsgBox "Couldn't get waveout meter"
    End If
    ' Initialize mixercontrol structure
    mxcd.cbStruct = Len(mxcd)
    volHmem = GlobalAlloc(&amp;H0, Len(volume)) ' Allocate a buffer for the volume value
    mxcd.paDetails = GlobalLock(volHmem)
    mxcd.cbDetails = Len(volume)
    mxcd.cChannels = 1
    End Sub
    Private Sub Check1_Click()
    If (Check1.Value = 1) Then
    StartInput ' Start receiving audio input
    Else
    StopInput ' Stop receiving audio input
    End If
    End Sub
    Private Sub Timer1_Timer()
    On Error Resume Next
    ' Process sound buffer if recording
    If (fRecording) Then
    For i = 0 To (NUM_BUFFERS - 1)
    If inHdr(i).dwFlags And WHDR_DONE Then
    rc = waveInAddBuffer(hWaveIn, inHdr(i), Len(inHdr(i)))
    End If
    Next
    End If
    ' Get the current input level
    If (ProgressBar1.Enabled = True) Then
    mxcd.dwControlID = inputVolCtrl.dwControlID
    mxcd.item = inputVolCtrl.cMultipleItems
    rc = mixerGetControlDetails(hmixer, mxcd, MIXER_GETCONTROLDETAILSF_VALUE)
    CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
    If (volume &lt; 0) Then
    volume = -volume
    End If
    ProgressBar1.Value = volume
    End If
    ' Get the current output level
    If (ProgressBar2.Enabled = True) Then
    mxcd.dwControlID = outputVolCtrl.dwControlID
    mxcd.item = outputVolCtrl.cMultipleItems
    rc = mixerGetControlDetails(hmixer, mxcd, MIXER_GETCONTROLDETAILSF_VALUE)
    CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
    If (volume &lt; 0) Then volume = -volume
    ProgressBar2.Value = volume
    End If
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
    If (fRecording = True) Then
    StopInput
    End If
    GlobalFree volHmem
    End Sub
    'Paste this code into the module
    Public Const CALLBACK_FUNCTION = &amp;H30000
    Public Const MM_WIM_DATA = &amp;H3C0
    Public Const WHDR_DONE = &amp;H1 ' done bit
    Public Const GMEM_FIXED = &amp;H0 ' Global Memory Flag used by GlobalAlloc functin
    Type WAVEHDR
    lpData As Long
    dwBufferLength As Long
    dwBytesRecorded As Long
    dwUser As Long
    dwFlags As Long
    dwLoops As Long
    lpNext As Long
    Reserved As Long
    End Type
    Type WAVEINCAPS
    wMid As Integer
    wPid As Integer
    vDriverVersion As Long
    szPname As String * 32
    dwFormats As Long
    wChannels As Integer
    End Type
    Type WAVEFORMAT
    wFormatTag As Integer
    nChannels As Integer
    nSamplesPerSec As Long
    nAvgBytesPerSec As Long
    nBlockAlign As Integer
    wBitsPerSample As Integer
    cbSize As Integer
    End Type
    Declare Function waveInOpen Lib "winmm.dll" (lphWaveIn As Long, ByVal uDeviceID As Long, lpFormat As WAVEFORMAT, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
    Declare Function waveInPrepareHeader Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
    Declare Function waveInReset Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
    Declare Function waveInStart Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
    Declare Function waveInStop Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
    Declare Function waveInUnprepareHeader Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
    Declare Function waveInClose Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
    Declare Function waveInGetDevCaps Lib "winmm.dll" Alias "waveInGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As WAVEINCAPS, ByVal uSize As Long) As Long
    Declare Function waveInGetNumDevs Lib "winmm.dll" () As Long
    Declare Function waveInGetErrorText Lib "winmm.dll" Alias "waveInGetErrorTextA" (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long
    Declare Function waveInAddBuffer Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
    Public Const MMSYSERR_NOERROR = 0
    Public Const MAXPNAMELEN = 32
    Public Const MIXER_LONG_NAME_CHARS = 64
    Public Const MIXER_SHORT_NAME_CHARS = 16
    Public Const MIXER_GETLINEINFOF_COMPONENTTYPE = &amp;H3&amp;
    Public Const MIXER_GETCONTROLDETAILSF_VALUE = &amp;H0&amp;
    Public Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &amp;H2&amp;
    Public Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &amp;H0&amp;
    Public Const MIXERLINE_COMPONENTTYPE_SRC_FIRST = &amp;H1000&amp;
    Public Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4)
    Public Const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3)
    Public Const MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2)
    Public Const MIXERCONTROL_CT_CLASS_FADER = &amp;H50000000
    Public Const MIXERCONTROL_CT_UNITS_UNSIGNED = &amp;H30000
    Public Const MIXERCONTROL_CT_UNITS_SIGNED = &amp;H20000
    Public Const MIXERCONTROL_CT_CLASS_METER = &amp;H10000000
    Public Const MIXERCONTROL_CT_SC_METER_POLLED = &amp;H0&amp;
    Public Const MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
    Public Const MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1)
    Public Const MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7)
    Public Const MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8)
    Public Const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_SIGNED)
    Public Const MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1)
    Declare Function mixerClose Lib "winmm.dll" (ByVal hmx As Long) As Long
    Declare Function mixerGetControlDetails Lib "winmm.dll" Alias "mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
    Declare Function mixerGetDevCaps Lib "winmm.dll" Alias "mixerGetDevCapsA" (ByVal uMxId As Long, ByVal pmxcaps As MIXERCAPS, ByVal cbmxcaps As Long) As Long
    Declare Function mixerGetID Lib "winmm.dll" (ByVal hmxobj As Long, pumxID As Long, ByVal fdwId As Long) As Long
    Declare Function mixerGetLineInfo Lib "winmm.dll" Alias "mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As Long) As Long
    Declare Function mixerGetLineControls Lib "winmm.dll" Alias "mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, ByVal fdwControls As Long) As Long
    Declare Function mixerGetNumDevs Lib "winmm.dll" () As Long
    Declare Function mixerMessage Lib "winmm.dll" (ByVal hmx As Long, ByVal uMsg As Long, ByVal dwParam1 As Long, ByVal dwParam2 As Long) As Long
    Declare Function mixerOpen Lib "winmm.dll" (phmx As Long, ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long
    Declare Function mixerSetControlDetails Lib "winmm.dll" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
    Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory" (struct As Any, ByVal ptr As Long, ByVal cb As Long)
    Declare Sub CopyPtrFromStruct Lib "kernel32" Alias "RtlMoveMemory" (ByVal ptr As Long, struct As Any, ByVal cb As Long)
    Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
    Declare Function GlobalLock Lib "kernel32" (ByVal hmem As Long) As Long
    Declare Function GlobalFree Lib "kernel32" (ByVal hmem As Long) As Long
    Type MIXERCAPS
    wMid As Integer
    wPid As Integer
    vDriverVersion As Long
    szPname As String * MAXPNAMELEN
    fdwSupport As Long
    cDestinations As Long
    End Type
    Type MIXERCONTROL
    cbStruct As Long
    dwControlID As Long
    dwControlType As Long
    fdwControl As Long
    cMultipleItems As Long
    szShortName As String * MIXER_SHORT_NAME_CHARS
    szName As String * MIXER_LONG_NAME_CHARS
    lMinimum As Long
    lMaximum As Long
    Reserved(10) As Long
    End Type
    Type MIXERCONTROLDETAILS
    cbStruct As Long
    dwControlID As Long
    cChannels As Long
    item As Long
    cbDetails As Long
    paDetails As Long
    End Type
    Type MIXERCONTROLDETAILS_SIGNED
    lValue As Long
    End Type
    Type MIXERLINE
    cbStruct As Long
    dwDestination As Long
    dwSource As Long
    dwLineID As Long
    fdwLine As Long
    dwUser As Long
    dwComponentType As Long
    cChannels As Long
    cConnections As Long
    cControls As Long
    szShortName As String * MIXER_SHORT_NAME_CHARS
    szName As String * MIXER_LONG_NAME_CHARS
    dwType As Long
    dwDeviceID As Long
    wMid As Integer
    wPid As Integer
    vDriverVersion As Long
    szPname As String * MAXPNAMELEN
    End Type
    Type MIXERLINECONTROLS
    cbStruct As Long
    dwLineID As Long
    dwControl As Long
    cControls As Long
    cbmxctrl As Long
    pamxctrl As Long
    End Type
    Public i As Integer, j As Integer, rc As Long, msg As String * 200, hWaveIn As Long
    Public Const NUM_BUFFERS = 2
    Public format As WAVEFORMAT, hmem(NUM_BUFFERS) As Long, inHdr(NUM_BUFFERS) As WAVEHDR
    Public Const BUFFER_SIZE = 8192
    Public Const DEVICEID = 0
    Public fRecording As Boolean
    Function GetControl(ByVal hmixer As Long, ByVal componentType As Long, ByVal ctrlType As Long, ByRef mxc As MIXERCONTROL) As Boolean
    ' This function attempts to obtain a mixer control. Returns True if successful.
    Dim mxlc As MIXERLINECONTROLS
    Dim mxl As MIXERLINE
    Dim hmem As Long
    Dim rc As Long
    mxl.cbStruct = Len(mxl)
    mxl.dwComponentType = componentType
    ' Obtain a line corresponding to the component type
    rc = mixerGetLineInfo(hmixer, mxl, MIXER_GETLINEINFOF_COMPONENTTYPE)
    If (MMSYSERR_NOERROR = rc) Then
    mxlc.cbStruct = Len(mxlc)
    mxlc.dwLineID = mxl.dwLineID
    mxlc.dwControl = ctrlType
    mxlc.cControls = 1
    mxlc.cbmxctrl = Len(mxc)
    ' Allocate a buffer for the control
    'hmem = GlobalAlloc(&amp;H40, Len(mxc))
    hmem = GlobalAlloc(GMEM_FIXED, Len(mxc))
    mxlc.pamxctrl = GlobalLock(hmem)
    mxc.cbStruct = Len(mxc)
    ' Get the control
    rc = mixerGetLineControls(hmixer, mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE)
    If (MMSYSERR_NOERROR = rc) Then
    GetControl = True
    ' Copy the control into the destination structure
    CopyStructFromPtr mxc, mxlc.pamxctrl, Len(mxc)
    Else
    GetControl = False
    End If
    GlobalFree (hmem)
    Exit Function
    End If
    GetControl = False
    End Function
    ' Function to process the wave recording notifications.
    Sub waveInProc(ByVal hwi As Long, ByVal uMsg As Long, ByVal dwInstance As Long, ByRef hdr As WAVEHDR, ByVal dwParam2 As Long)
    If (uMsg = MM_WIM_DATA) Then
    If fRecording Then
    rc = waveInAddBuffer(hwi, hdr, Len(hdr))
    End If
    End If
    End Sub
    ' This function starts recording from the soundcard. The soundcard must be recording in order to
    ' monitor the input level. Without starting the recording from this application, input level
    ' can still be monitored if another application is recording audio
    Function StartInput() As Boolean
    If fRecording Then
    StartInput = True
    Exit Function
    End If
    format.wFormatTag = 1
    format.nChannels = 1
    format.wBitsPerSample = 8
    format.nSamplesPerSec = 8000
    format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8
    format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign
    format.cbSize = 0
    For i = 0 To NUM_BUFFERS - 1
    hmem(i) = GlobalAlloc(&amp;H40, BUFFER_SIZE)
    inHdr(i).lpData = GlobalLock(hmem(i))
    inHdr(i).dwBufferLength = BUFFER_SIZE
    inHdr(i).dwFlags = 0
    inHdr(i).dwLoops = 0
    Next
    rc = waveInOpen(hWaveIn, DEVICEID, format, 0, 0, 0)
    If rc &lt;&gt; 0 Then
    waveInGetErrorText rc, msg, Len(msg)
    MsgBox msg
    StartInput = False
    Exit Function
    End If
    For i = 0 To NUM_BUFFERS - 1
    rc = waveInPrepareHeader(hWaveIn, inHdr(i), Len(inHdr(i)))
    If (rc &lt;&gt; 0) Then
    waveInGetErrorText rc, msg, Len(msg)
    MsgBox msg
    End If
    Next
    For i = 0 To NUM_BUFFERS - 1
    rc = waveInAddBuffer(hWaveIn, inHdr(i), Len(inHdr(i)))
    If (rc &lt;&gt; 0) Then
    waveInGetErrorText rc, msg, Len(msg)
    MsgBox msg
    End If
    Next
    fRecording = True
    rc = waveInStart(hWaveIn)
    StartInput = True
    End Function
    ' Stop receiving audio input on the soundcard
    Sub StopInput()
    fRecording = False
    waveInReset hWaveIn
    waveInStop hWaveIn
    For i = 0 To NUM_BUFFERS - 1
    waveInUnprepareHeader hWaveIn, inHdr(i), Len(inHdr(i))
    GlobalFree hmem(i)
    Next
    waveInClose hWaveIn
    End Sub
    Error if using winmm.dll, kernel32  in x64 mode 

Maybe you are looking for

  • StringTokenizer

    I'm trying to learn about StringTokenizer and I have a few questions. 1) Can someone give me some good links to learn about the subject? 2) By the way, does anyone else find Suns documentation confusing? Or am I just not advanced enough? For example:

  • Aspect ratio of iPad mirror is not 4:3 when mirrored with Apple TV

    Hi Everyone - I have just bought an Apple TV 3 and installed the device yesterday. I am using an LG HDTV and an iPad3. Everything works fine except one thing: When I mirror my iPad in landscape on the TV it appears with a wrong aspect ratio. This mea

  • Dreamweaver Accordian not working in IE6

    I've added the Spry Accordian function to a page but it only works correctly in Safari 2. On opening the page in both Firefox and IE 6 only the first level displays, the second and third level are invisible. Only after clicking in the general area wh

  • Bridge goes nuts if a PDF is in the directory it is trying to display

    I'm running the latest updates of PS CS3 and Bridge CS3 on a MacBook with the latest rev of Tiger, and the latest update of Adobe Reader. If I aim Bridge at a directory that contains a PDF file, both CPU's max out and the temperature jumps 20 C. I ha

  • Issue in passing process order related to order type ZGP9.

    Hi Experts, There has been a development done in CIF user exit to block process orders having order type ZGPD & ZGP7. But we are also facing issue for process order flow for order type ZGP9.  1. To avoid double counting of Depack orders (order type Z