Creating a Player from an InputStream

Hi guyz
I have a media application am writing with an issues on it.
The application is to receive Byte chucks containing media content with a content type String from a network via RMI
Is there any samples code for creating a player from an InputStream in JMF? Something to do with a java.io.ByteArrayInputStreamAt the moment am forced to write the byte chucks to a temporary file then pass the file to JMF which is working OK, byte i belive the must be a better way to Override the temp file.
I believe this is possible since sun provides the same for J2ME javax.microedition.medi.Manager.createPlayer(java.io.InputStream stream,  java.lang.String type) of which the MIDlet version of my application processes the same quite fine.
If not i have tried to implement my own DataSource for known media formats after i checked out this thread http://forums.sun.com/thread.jspa?threadID=5264968 but kept me stack for some days so i decided to come out here and look for some help. Ad really appreciate some feedback.
Thanks in advance.

Well i have a small glitch that i don't quit understand don know whether to ask here or no or it should be on a new thread. but her goes.
I am under Mandriva2008.1 with JMF performance pack installed on my classpath. i register jffmpeg plugin on the fly and can play most of the video and audio files supported by jffmpeg though not in so good of the quality but in just works 4me since am only using it for preveiw purposes.
The problem is that i used mencoder mencoder vcd://02 -vf scale=640:272 -o track02.mpg -oac copy -ovc lavc -lavcopts vcodec=mpeg4 from the console to convert some VCD files to mpeg4 but the JVM just crashes when i try to open the files. After i look at the crash log it is related to some native libraries C  [libjmmpx.so+0x14b54].
Wonder whether is the mencoder issue i.e am using the wrong mencoder args or is it that JMF is loading the wrong decoder for the mpeg4 codec?

Similar Messages

  • Create ebXML message from a InputStream

    I am using the Java XML summerpack 02.
    I have the complete ebXML file as a InputStream and I
    want to construct an EbXMLMessageImpl (or SOAPMessage - speaking generically) from this input stream.
    A sample ebXML file I have is as follows:
    Host: www.example.com
    SOAPAction: "ebXML"
    Content-type: multipart/related; boundary="BoundarY"; type="text/xml";start="<[email protected]>"
    --BoundarY
    Content-ID: <[email protected]>
    Content-Type: text/xml
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP:Envelope xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd"
    xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
    http://www.oasis-open.org/committees/ebxml-msg/schema/envelope.xsd
    http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd
    http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd">
    <SOAP:Header>
    <eb:MessageHeader SOAP:mustUnderstand="1" eb:version="2.0">
    <eb:From>
    <eb:PartyId>urn:duns:123456789</eb:PartyId>
    </eb:From>
    <eb:To>
    <eb:PartyId>urn:duns:912345678</eb:PartyId>
    </eb:To>
    <eb:CPAId>20001209-133003-28572</eb:CPAId>
    <eb:ConversationId>20001209-133003-28572</eb:ConversationId>
    <eb:Service>urn:services:SupplierOrderProcessing</eb:Service>
    <eb:Action>NewOrder</eb:Action>
    <eb:MessageData>
    <eb:MessageId>[email protected]</eb:MessageId>
    <eb:Timestamp>2001-02-15T11:12:12</eb:Timestamp>
    </eb:MessageData>
    </eb:MessageHeader>
    </SOAP:Header>
    <SOAP:Body>
    <eb:Manifest eb:version="2.0">
    <eb:Reference xlink:href="cid:[email protected]"
    xlink:role="XLinkRole" xlink:type="simple">
    <eb:Description xml:lang="en-US">Purchase Order 1</eb:Description>
    </eb:Reference>
    </eb:Manifest>
    </SOAP:Body>
    </SOAP:Envelope>
    --BoundarY
    Content-ID: <[email protected]>
    Content-Type: text/xml
    <?xml version="1.0" encoding="UTF-8"?>
    <purchase_order>
    <po_number>1</po_number>
    <part_number>123</part_number>
    <price currency="USD">500.00</price>
    </purchase_order>
    BoundarY
    Is there a straight forward way of creating a SOAP message object from an input stream ?
    Any information relating to this would be very helpful.
    Thanks,
    Anant.

    While trying to create an ebXMLMessageImpl object using
    EbXMLMessageImpl(javax.xml.soap.MimeHeaders headers, java.io.InputStream in)
    I am getting an exception:
    Warning: Error occurred using JAXP to load a SAXParser. Will use Aelfred instead
    Exception in thread "main" java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.dom4j.TextImpl
    at com.sun.xml.messaging.jaxm.ebxml.EbXMLMessageImpl.fillInHeaders(EbXML
    MessageImpl.java:137)
    at com.sun.xml.messaging.jaxm.ebxml.EbXMLMessageImpl.<init>(EbXMLMessageImpl.java:117)
    My code has created the following MimeHeaders :
    Mime Header name : Host , MimeHeader Value : www.example2.com
    Mime Header name : SOAPAction , MimeHeader Value : "ebXML"
    Mime Header name : Content-type ,
    and its corresponding MimeHeader Value is : multipart/related; boundary="BoundarY"; type="text/xml";start="<[email protected]>"
    and I used the inputstream along with it to create the object.
    Pls. reply if you have any info on this or how to create an ebXMLMessage object from an inputstream.
    Thanks,
    Anant.

  • Create one player to play RTP packets from many clients

    Hi,
    Am a JMF newbie and I want to create one player to play packets from many clients.
    So I wrote a small UDPserver thread within the app to receive rtp packets from the clients on the LAN which in turn forwards them to the player.
    I instatiated two threads one to forward RTP packets and another to forward RTCP packets which listens on RTPPort+1
    The reason why i do this is that i don't want the whole internet to bombard the player with anonymous voice transmissions.So the server thread is acting as a firewall. To filter out packets from from unknown ip addresses.
    this is a snippet of the player.
    MY_IPADDRESS =   InetAddress.getLocalHost().getHostAddress();+
    url = "rtp://" + MY_IPADDRESS + ":" + RTPPlayer.PORT + "/audio/1";
    MediaLocator mrl = new MediaLocator(url);
    player = Manager.createPlayer(mrl);
    More code which starts the server thread
    if (player != null) {
           player.addControllerListener(this);
           player.realize();
    player.start();When the server thread receives the packet it calls its forward method to forward the packet to the player by resetting the only the IP and PORT.
    public void forward(DatagramPacket rtpPacket) {
             //print out packet info to view which packets are being received
             System.out.println("forwarding "+request.getAddress() + " -> " + MY_IPADDRESS+":"+portToSend);
             //set address of packet to MY_IPADDRESS
           rtpPacket.setAddress(
                   InetAddress.getByName(RTPPlayer.MY_IPADDRESS));
              //set the port to the rtp port
           rtpPacket.setPort(RTPPlayer.PORT);
           datagramSocket.send(rtpPacket);
    }This works fine for two clients.
    When the clients become three(c1, c2 and c3),
    two clients communicate well(c1 and c2) but c3's voice cannot be heard on any other pc(c1 or c2) though it plays voice from both c1 and c2.
    But System.out.println("forwarding "+request.getAddress() + " -> " + MY_IPADDRESS+":"+portToSend);in the forward() method shows that packets from all clients on each pc are being received.
    Does any one have an idea why this happens?
    Are the packets so many that they overwhelm the player so it discards some or all?
    Is this the best way of doing this?
    Just to let u know all the mics are working fine.
    Thx in advance
    Edited by: noryak on Oct 29, 2008 10:29 AM

    THAT IS MY MAIN PROBLEM. In the future, please do a little bit of research before you shout at people trying to help you. I'm so so sorry if you find my answer bothersom because it sheds some light on the fact that you have absolutely no idea what you're doing.
    Your problem is that you obviously do not understand how JMF works...and you obviously havn't bothered to do any sort of research into it.
    You also don't seem to understand the concept of streaming media, concurrency, politeness, good design, proper programming, audio interleaving, or common sense.
    At least i have implemented a player playing packets from 2 different clients.Yeah, you implemented a player that plays packets from 2 different clients using a horrible workaround that doesn't treat the data correctly and manages to just drop data after scaling past 2 clients.
    Oh yeah, you've definately found the holy grail there. At least.
    You wanna know what your player is actually doing? It's playing a peice of data from A, and then a peice of data from B. It might sound like it's playing them both at the same time, but it's not. It's playing the data from one client in the gaps where there's no data, and once you've filled up the gaps in time by adding more nodes, you'll end up with data getting dropped (and that's the best case scenerio).
    my issue is that i wouldn't like to create a player for each participant imagine they were people in a conference that makes it 10 players. Please understand that if you have 10 players, you'll receive 10 times as much data as you can play with one player. You end up either having to drop 90% of your data, or having to play the data at 1/10th the speed... because you're not mixing the audio data, you're interleaving it.
    I just want to use one standard port on each client so that all clients send to the same port: The RTPManager class will allow you to receive as many streams as you want on a single port.
    As a matter of fact, had you bothered to play with any of the source code readily available online, you'd realize there is a file that does exactly what you want.
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/AVReceive2.java]
    It handles receiving multiple RTP streams from a single port, and plays them all simultaniously using an array of player objects.
    Does absolutely everything you want, out of the box.
    That sounds like alot of threadsIf you're concerned that it's too many threads, well, maybe you should stick to hello world and other things less scary. Concurrent data processing requires threads...one per peice of concurrent data, as a matter of fact, and you're dealing with a lot of streams of concurrent data here.

  • How Do I Stop Flash Player From Storing Cache?

    Windows XP SP3
    Latest Flash Player (i just upgraded it to the latest as of today)
    There are a couple of directories on my HDD that appear to be the place where Flash stores cache.
    One of them is (#1):
    c:\Documents and Settings\User\Application Data\Adobe\Flash Player\AssetCache\
    The other is (#2):
    c:\Documents and Settings\User\Application Data\Macromedia\Flash Player\#sharedobjects
    These directories were so bloated with subdirectories that it literally took about 12 HOURS OR MORE to delete everything in them!  I'm not kidding.
    There must have been 100,000 subfolders or maybe even more in these folders.  They were choking everything on my computer that had to read past them.
    I FINALLY was able to delete everything from them after hours of work.
    Now I want to keep them empty, so this doesn't happen again but I can't find out how to do that.  It is so dang frustrating.  I looked and looked for a way to shut this storage off.
    I finally found the online "Settings Manager" and thought I FINALLY solved the problem after setting the "Global Storage" setting to "Never" and unchecking the "Allow third party Flash content to be stored on your computer" and "Store common Flash components to reduce download times" boxes.
    BUT NO!!!
    It didn't do a thing.  I looked at those two folders again and they are still being filled up with new subfolders!!!!
    UUUURRRRRRRRRRRRRRRRRRRRRRRRRRRR!
    How do I keep Flash Player from storing this unwanted mess on my computer?!
    Thank you for ANY HELP!

    PS:
    Before I set the global settings as I stated above, I DELETED all the "Websites already visited" from the list in Settings Manager so that ALL Websites would be set according to the global settings.
    But none of that did a thing to stop the new folders from being created anyway.  How do I stop them??!!!

  • Creating a DVD from camcorder video tape

    Hi all,
    I am tasked with creating a DVD from some of my dads camcorder tapes. Can anyone provide a simple advice list. I assume that iDVD (which i have never used) will be the software to use?
    Look forward to hearing from you helpful and intelligent people out there.
    From a complete simpleton.
    Kind regards,
    Alan

    The easiest way (if you don't want to do any editing)
    buy a dvd player/recorder, connect the video out of the camcorder to the dvd recorder input.

  • Play a video from an InputStream

    Hi!
    Is it possible to load a video in JavaFX from an InputStream? I want to implement a video player with JavaFX that can play an encrypted video received from the network. I have noticed that it is not possible to do this using the classes MediaPlayer (javafx.scene.media.MediaPlayer) or MediaComponent (com.sun.fxmediacomponent.MediaComponent), and I have read that this version does not support JafaFX video encoding. The question is the following: is it possible to load a video from a Stream that has been previously tried manually, although it would be necessary to download it whole before playing it?
    Thank you

    You could probably use an SSLSocket to read the video file from an encrypted stream, save it as a file on the client machine, and then read the video from the file to the MediaPlayer if that's what you mean.

  • Custom Video Player from Adobe Photoshop to Catalyst

    I create a video player in Photoshop (a .psd file, obviusly) and I want to make it work in Flash Catalyst without using the standart skin o' video player from there. It's possible?
    if so, how would the procedure? Something very complicated?
    Thank you.
    @eldermarx

    Hi there,
    You can't skin the video player the way you can skin wireframe components like a button or data list. However, you can create a custom component that contains your video, and several buttons that control playback using Catalyst interactions.
    You would place your video in the artboard, set its controls to "No Chrome", and then add your play, pause, and stop buttons. You'd need to wire up interactions to these buttons to play, pause, and stop the video.
    -Bear

  • How to automatically create a player schedule?

    I need your help how to automatically create a player schedule from a given list of players who will play doubles in a given period.
    Let's say, I have a list of 12 players who will each play doubles with random partners for 4 times.
    So play one could be: 1&2 vs 3&4, 5&6 vs 7&8, 9&10 vs 11&12.
    But now I want inumbers to plan the second, third and fourth play automatically but with unique combinations.
    In this example it's quite easy to do it manually, but I need to plan something similar for the tennisclub with many more players.
    It should be able to set up a worksheet where you will fill out the following parameters:
    List of players, number of available courts, whether you want ot let them play single or double games, number of plays.
    The last one could also be left empty so discover how many unique plays you have given the other parameters.
    I hope someone is able to help me, because this would save me a lot of time to make the planning for the tennisclub.
    Thanks in advance for any support!

    OK.  I think this may work for you:
    There are two parts:
    1) a small program you have to run (this is the part you may find difficult at first)
    2) a Numbers spreadsheet
    1) the program is invoked on the command line in the terminal.  You can open the Terminal by navigating to the folder "/Applications/Utilities"
    you need to download the zip file here, then copy and unzip  in the same folder where you plan to store the Numbers document for making the tennis schedule.
    Let's agree for this procedure that you are storing the program and Numbers file in the folder "/Users/<your user name>/Documents/TennisSchedule".
    Once you launch the terminal you can navigate to the folder where you stored the zip file by typing:
    cd ~/Documents/TennisSchedule
    now you can invoke the program by typing:
    ./TennisRandomList
    Then hit the return key.  Without any arguments the program simply emits some program information with a little help on how to use it-- described in the text starting with "USAGE" (see below)
    Proton:TennisRandomList wayne$ ./TennisRandomList
    Tennis Randomw List maker
    Version 0.1
    compiled on Nov 18 2012 @ 09:14:41
    USAGE: TennisRandomList numPlayers numCourts numWeeks type verbosity
      numPlayers: 1 - 255
      numCourts: 1 - 255
      numWeeks: 1 - 255
      type: [s]ingle or [d]ouble
      verbosity: 0 - 5
      0 -> player ids only
      1 -> player ids + inputs
      2 -> player ids + inputs + raw random values
      3 -> player ids + inputs + raw random values + pairings
      4 -> player ids + inputs + raw random values + pairings
      5 -> player ids + inputs + raw random values + pairings
    Proton:TennisRandomList wayne$
    so to make a schedule for:
    -12 players
      - 3 courts
    - 6 weeks
    - singles
    you would invoke as:
    ./TennisRandomList 12 3 6 s
    Then type return.
    you should get something like:
    Proton:TennisRandomList wayne$ ./TennisRandomList 12 3 6 s
    Weeks: 6
    Players: 12
    Courts: 3
    Type: singles
              Game
    Week          Slot          Court 1          Court 2          Court 3
    1          1          3          2          4          6          5          8
    1          2          9          11          10          12          1          7
    2          1          12          2          7          10          11          1
    2          2          3          5          8          4          9          6
    3          1          6          11          2          1          7          3
    3          2          4          8          5          10          9          12
    4          1          4          8          11          3          5          7
    4          2          10          12          1          6          9          2
    5          1          8          4          3          12          9          5
    5          2          6          10          7          11          1          2
    6          1          5          7          1          12          3          10
    6          2          6          8          2          4          9          11
    Proton:TennisRandomList wayne$
    You can select, then copy the text following the line "Week Slot Court 1 Court 2 Court 3" upto, but not including, "Proton:TennisRandomList wayne$ "-- bolded in the above quotation
    You can paste that into the Numbers document we will now make.
    2) a Numbers spreadsheet
    The Numbers document includes several tables as shown below:

  • MediaPlay to play media from an InputStream

    I think there is a compelling use case that needs the MediaPlayer to play media from an InputStream instead of the protocols such as http, file, and jar which are supported by JavaFx right now.
    If your JavaFX runs inside your browser and if you generate some audio on the fly and put it in a byte array in your local memory, there is no way you can play it. None of the available workarounds are elegant. If you attempt to save that audio into a file temporarily and intend to play it from the file, you would need to trouble your users with the security permission pop-up. If you create a webserver programmatically on the client machine, you would also need to ask the users for socket permission. If you try to save the audio into the javafx.io.Storage, you cannot access it as a java.io.File object, thus you cannot use the file:/// protocol anymore. Well, you could send the audio to a remote webserver somewhere and read it back through http, that works but it is plainly silly.
    Above all, if the InputStream is supported by MediaPlayer, all other three (http, file, jar) would be automatically taken care of because all those three can be converted to an InputStream one way or another,
    Also, before an InputStream hits the MediaPlayer, you can process it any way you want. For example, you could place an Ogg Vorbis encoder/decoder along the pipeline between the MediaPlayer and the media source. Then I believe the Ogg Vorbis issue will be resolved automatically.

    I think that is not possible indeed. You can handle InputStream as well saving as a file and read that file long after save it. So the Media from MediaPlayer can read a file using source attribute.
    But I agree with you. The possibilities to handle InputStream directly is more interesting, you can read from a internal file added in jar, can read from a Socket connection without the necessity to save to a file. You can read directly from a database record, so, that resource is more flexible
    I think JavaFX media support aim is focused to read local resources unfortunately.

  • Last flash player from Adobe is broken

    Hello
    Last flash player from Adobe seems to be broken when using with Chatroulette:
    on Macbook Air camera stopped working
    on iMac 27" works, but Safari takes 100% cpu (when Flash Player is running with Chatroulette)
    Other users experience the same
    My configuration
    Mac OS 10.6.4
    Flash Player: 10.1.102.64, 10,1,103,19
    Safari, Chrome
    I tried re-installing Flash Player, creating new account, changing language, changing browsers, running Disc Utility = nothing helped
    I tried downloading Chrome because I heard there is different version of Flash Player (10,1,103,19)
    Result is same.
    Hardware is brand new, operating system is brand new. Everything worked until last flash update.
    Please assist! Some of our users experience the same problems
    As a temporary solution I have installed Adobe Flash Player 10.2 but it is unstable and our users cannot do that. However it works
    Thanks much
    Andrey

    This is STILL an issue.   There is something badly broken in the Mac version of Flash 10.   I have a brand new macbook pro, and had the original install of flash 9.  My cameras worked fine.   When I upgraded to 10 -- and yes, I *did* uninstall the previous version -- I lost the ability to config my camera, since it stopped appearing in the control panel dialog.
    I uninstalled Flash 10, saying many not-so-nice things about Adobe and their exceptionally poor QA in the process, and re-installed Flash 9.   Sure enough, my cam worked like a charm. 
    Hey Adobe guys:   If you are reading these forums, PLEASE try to fix this!!!!  Downgrading is only a temporary fix, as more and more sites are specifically requiring for Flash 10.
    GET YOUR QA TEAM TO TEST THIS!!!!!!!!!  PLEASE!!!!!!!!

  • Is there a way to create a playlist from the now playing screen on ios7?

    Is there a way to create a playlist from the now playing screen on ios7? I want to be able to hear a song in my collection and immediately add it to an existing playlist or create a new playlist.
    Thank you in advance

    Hi Cornellius,
    From the now playing screen there's a Create button at the bottom that allows you to create a
    Genius Playlist
    New Station form Artist
    New Station from Song
    IPhone Help, Browse and play
    http://help.apple.com/iphone/7/#/iph3cf21a82
    The Now Playing screen provides playback controls and shows you what’s playing.
    For information on Genius Playlists, see
    Archived - Genius for iPod and iPhone
    http://support.apple.com/kb/HT2978
    I don't see an option to add it to an existing playlist.
    Best Regards,
    Nubz

  • Error while posting a sales order created with reference from contract for

    Hi,
    I am posting a sales document( Type: WA)  created with reference from contract document(  type wk2) for delivery.  The item category in the sales order of the Item is WAN. On posting this document for delivery I am getting the error as "Item category WAN is not defined".  Please help me out how to resolve this issue.
    Thanks
    Jayant

    Hi Jayant,
    I think its value contract releated error,
    You suppose to check material item category group through T.code-MM02 into sales2 tab and maintain VCIT,
    and do item category assignment through T.code- VOV4.
    plz.maintain like that,
    WK2 -          -VCIT-         -           - WAN(contract item category),
    wk2  -          -        -VCTR-          - WAN((contract item category),
    you should also maintain same against your standard Sales Document type and for Standard Item category into VOV4,
    WA(standard docu.type) -VCIT-                             -                -TAN(your standard docu.type item category),
    WA(standard docu.type) -         -VCTR(item usage)-              -TAN(your standard docu.type item category),

  • Create XML file from ABAP with SOAP Details

    Hi,
    I am new to XML and I am not familiar with JAVA or Web Service. I have searched in SDN and googled for a sample program for creating XML document from ABAP with SOAP details. Unfortunately I couldn't find anything.
    I have a requirement for creating an XML file from ABAP with SOAP details. I have the data in the internal table. There is a Schema which the client provided and the file generated from SAP should be validating against that Schema. Schema contains SOAP details like Envelope, Header & Body.
    My question is can I generate the XML file using CALL TRANSFORMATION in SAP with the SOAP details?
    I have tried to create Transformation (Transaction XSLT_TOOL) in SAP with below code. Also in CALL transformation I am not able to change the encoding to UTF-8. It's always show UTF-16.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="/">
        <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
          <SOAP:Header>
            <CUNS:HeaderInfo>
              <CUNS:InterfaceTypeId>10006</InterfaceTypeId>
              <CUNS:BusinessPartnerID>11223344</BusinessPartnerID>
              <CUNS:SchemaVersion>1.0</SchemaVersion>
              <CUNS:DateTime>sy-datum</DateTime>
            </CUNS:HeaderInfo>
          </SOAP:Header>
          <SOAP:Body>
            <xsl:copy-of select="*"/>
          </SOAP:Body>
        </SOAP:Envelope>
      </xsl:template>
    </xsl:transform>
    In ABAP program, I have written below code for calling above Transformation.
      call transformation ('Z_ID')
           source tab = im_t_output[]
           result xml xml_out.
      call function 'SCMS_STRING_TO_FTEXT'
        exporting
          text      = xml_out
        tables
          ftext_tab = ex_t_xml_data.
    Please help me how to generate XML file with SOAP details from ABAP. If anybody have a sample program, please share with me.
    Is there any easy way to create the XML file in CALL Transformation. Please help.
    Thanks

    Try ABAP forum, as it seems not to be PI related.

  • Need help in creating a chart from 3 datasets

    Need help in creating a chart in SSRS from 3 datasets
    Can someone help me in creating a chart from 3 datasets, however datasource is same.

    Thank you Olaf...
    could anyone help me in using union all with the below
     WITH a AS (
    SELECT
    clientid,
    DATEPART(year, row_date) AS 'Year',
    DATEPART(month, row_date) AS 'Month',
        value ,
        CASE metricid WHEN 16 THEN 'FCR' ELSE 'Cases' END AS metric
    FROM XXXXXX AS V
    WHERE metricid IN (16, 11)
    AND row_date BETWEEN '2012-01-01' AND '2014-10-01'
    AND value IS NOT NULL)
    , b AS (
    SELECT     clientid ,
        Year ,
        Month ,
        value AS 'Cases',
        metric 
    FROM a
    WHERE metric = 'cases')
    , c AS (
    SELECT     clientid ,
        Year ,
        Month ,
        value AS 'FCR',
        metric  
    FROM a
    WHERE metric = 'FCR')
    , d AS (
    SELECT b.YEAR, b.MONTH, c.FCR, b.Cases 
    FROM b INNER JOIN c 
    ON c.clientid = b.clientid
    AND c.[YEAR] = b.[year] 
    AND c.[month] = b.[month]
    WHERE c.fcr <> 0 AND b.cases <> 0
    ,E AS (
    SELECT [Year], [Month], SUM(FCR) AS FCR, SUM(Cases) AS Cases
    FROM d
    GROUP BY [Year], [Month])
    select YEAR, MONTH, 
    CASE MONTH 
    WHEN 1 THEN 'Jan'
    WHEN 2 THEN 'Feb'
    WHEN 3 THEN 'Mar'
    WHEN 4 THEN 'Apr'
    WHEN 5 THEN 'May'
    WHEN 6 THEN 'Jun'
    WHEN 7 THEN 'Jul'
    WHEN 8 THEN 'Aug'
    WHEN 9 THEN 'Sep'
    WHEN 10 THEN 'Oct'
    WHEN 11 THEN 'Nov'
    WHEN 12 THEN 'Dec'
    END AS MonthName
    ,e.FCR AS FCRCases
    ,e.Cases AS TotalCases
    ,CASE 
    WHEN [month] IN (11, 12, 1) THEN 1
    WHEN [month] IN (2, 3, 4) THEN 2
    WHEN [month] IN (5, 6, 7) THEN 3
    WHEN [month] IN (8, 9, 10) THEN 4
    END AS 'Quarter'
    --,CONVERT(DECIMAL(18, 2),(e.FCR/e.Cases)*100) AS FCRRaw
    from e
    order by YEAR, MONTH
    **************2nd query*************
    WITH a AS (
    SELECT
    clientid,
    DATEPART(year, row_date) AS 'Year',
    DATEPART(month, row_date) AS 'Month',
        value, 
        CASE metricid WHEN 56 THEN 'numerator' ELSE 'denominator' END AS metric
    FROM XXXXXXX.[Values] AS V
    WHERE metricid IN (56, 10)
    --WHERE metricid IN (11,16)
    AND row_date BETWEEN '2013-10-01' AND '2014-02-01'
    AND value IS NOT NULL)
    , b AS (
    SELECT     clientid ,
        Year ,
        Month ,
        value AS 'numerator',
        metric
    FROM a
    WHERE metric = 'numerator')
    , c AS (
    SELECT     clientid ,
        Year ,
        Month ,
        value AS 'denominator',
        metric
    FROM a
    WHERE metric = 'denominator')
    , d AS (
    SELECT b.YEAR, b.MONTH, c.denominator, b.numerator 
    FROM b INNER JOIN c 
    ON c.clientid = b.clientid
    AND c.[YEAR] = b.[year] 
    AND c.[month] = b.[month]
    WHERE c.denominator <> 0 AND b.numerator <> 0
    , e AS (
    SELECT [Year], [Month], SUM(numerator) AS numerator, SUM(denominator) AS denominator
    FROM d
    GROUP BY [Year], [Month]
    SELECT *, 
    CASE 
    WHEN [month] IN (11, 12, 1) THEN 1
    WHEN [month] IN (2, 3, 4) THEN 2
    WHEN [month] IN (5, 6, 7) THEN 3
    WHEN [month] IN (8, 9, 10) THEN 4
    END AS 'Quarter'
    FROM e
    ORDER BY 1,2
    ******************3rd query**************
    WITH a AS (
    SELECT --L.[LocationGroupId],
    -- T.locationid,
    -- T.AccountId,
    TR.datestamp,
    /*Convert(NVARCHAR, DatePArt(year, TR.datestamp)) + '-' + Convert(NVARCHAR, DatePArt(month, TR.datestamp)) + '-01'*/ 
    TR.Period AS ValueDate,
    CASE WHEN TR.TargetResultState = 0 THEN 0 WHEN TR.TargetResultState = 1 THEN 1 WHEN TR.TargetResultState = 2 THEN 1 ELSE 0 END AS Met,
    CASE WHEN CONVERT(DATE, Convert(NVARCHAR, DatePArt(year, TR.datestamp)) + '-' + Convert(NVARCHAR, DatePArt(month, TR.datestamp)) + '-01') > T.Startdate AND CONVERT(DATE, Convert(NVARCHAR, DatePArt(year, TR.datestamp))
    + '-' + Convert(NVARCHAR, DatePArt(month, TR.datestamp)) + '-01') < T.Enddate THEN 1 ELSE 0 END AS ActiveTarget
    FROM XXXXXX AS TR
    INNER JOIN dbo.Target T ON TR.TargetID = T.ID
    --INNER JOIN dbo.Location L ON T.Locationid = L.Id
    WHERE --locationid <> - 1 AND 
    TR.Period IN ('201306', '201307', '201308', '201309', '201310', '201311', '201312', '201401'))
    select ValueDate, SUM(Met) AS Met, Count(ActiveTarget) AS ActiveTargets,
    right(ValueDate,2) as Month
    ,left(ValueDate,4) as Year
    ,CASE 
    WHEN right(ValueDate,2) IN (11, 12, 1) THEN 1
    WHEN right(ValueDate,2) IN (2, 3, 4) THEN 2
    WHEN right(ValueDate,2) IN (5, 6, 7) THEN 3
    WHEN right(ValueDate,2) IN (8, 9, 10) THEN 4
    END AS 'Quarter'
    from a
    group by ValueDate
    order by ValueDate

  • How to create a Report from WebDympro

    Hi All,
    I just want to know how I can create a report from WebDynpro? I need to pull data from R/3 using a RFC function module, but I don't know if it exists a software to create reports.
    Thanks in advance
    Alexis Ramirez

    Hi Rich,
    Even i had a similar kind of problem. I wanted to fetch data from BI through the XMLA Connector which are created in Query Designer and then i wanted to fetch these fields and rearrange them and put it in a report format by colouring certain fields. Can the same can be done in WebDynpro.

Maybe you are looking for

  • How do I generate formula with column of text?

    I have a list of attendees to an upcoming party. Three columns - First Name, Last Name, Attendance. In the "Attendance" column I have created drop down menues with 4 different text values regarding their attendance (Yes, No, Maybe, No Reply). At the

  • IPod not charging after only 6 months

    After only 6 months, my iPod (color display) seems to have stopped taking charges. When plugged into computer, a very faint image appears saying something like "Battery power very low." We brought to an iPod store. They said the battery is fine, and

  • Always looping RUnning Debt

    I'm already create 2 view using union to union the transaction 1. View Transaction (View For Union all the transaction debet n kredit) 2. View LAST_SALDO (View for find Last Customer Customer Debt) I have a problem when i query it looking for Running

  • Simple way to select and remove duplicate images.

    As I work diligently to have Aperture manage all of my image files I have come top the realization that I have a number of duplicate image files scattered over a number of resources. Is there a simple way to have Aperture identify the duplicates and

  • Asset under construction in internal order

    Dear All,     can any one tell me how to create Asset under construction in internal order... Suresh patipati.