Filling the gap with previous data and newdate...

input data
GLOBAL_NAME     PRODUCT_MODEL     TRX_TYPE     POS_DATE     QUANTITY
ABC          MAW3147NC     POS          3/17/2008     111
ABC          MAW3147NC     POS          4/14/2008     100
ABC          MAW3147NC     POS          5/26/2008     200
ABC          MAW3147NC     SHIPMENT     3/17/2008     222
ABC          MAW3147NC     SHIPMENT     4/7/2008     40
ABC          MAW3147NC     SHIPMENT     4/14/2008     80
ABC          MAW3147NC     SHIPMENT     4/21/2008     160
ABC          MAW3147NC     SHIPMENT     4/28/2008     162
ABC          MAW3147NC     SHIPMENT     5/19/2008     182
ABC          MAW3147NC     SHIPMENT     5/26/2008     262output
GLOBAL_NAME     PRODUCT_MODEL     TRX_TYPE     POS_DATE     QUANTITY
ABC          MAW3147NC     POS          3/17/2008     111
ABC          MAW3147NC     POS          3/24/2008     111 --> previous record values but pos_date should be next monday
ABC          MAW3147NC     POS          3/31/2008     111--> previous record values but pos_date should be next monday
ABC          MAW3147NC     POS          4/7/2008     111--> previous record values but pos_date should be next monday
ABC          MAW3147NC     POS          4/14/2008     100
ABC          MAW3147NC     POS          4/21/2008     100--> previous record values but pos_date should be next monday
ABC          MAW3147NC     POS          4/28/2008     100--> previous record values but pos_date should be next monday
ABC          MAW3147NC     POS          5/05/2008     200
ABC          MAW3147NC     SHIPMENT     3/17/2008     222
ABC          MAW3147NC     SHIPMENT     3/24/2008     222--> previous record values but pos_date should be next monday
ABC          MAW3147NC     SHIPMENT     3/31/2008     222--> previous record values but pos_date should be next monday
ABC          MAW3147NC     SHIPMENT     4/7/2008     40
ABC          MAW3147NC     SHIPMENT     4/14/2008     80
ABC          MAW3147NC     SHIPMENT     4/21/2008     160
ABC          MAW3147NC     SHIPMENT     4/28/2008     162
ABC          MAW3147NC     SHIPMENT     5/05/2008     162--> previous record values but pos_date should be next monday
ABC          MAW3147NC     SHIPMENT     5/12/2008     162--> previous record values but pos_date should be next monday
ABC          MAW3147NC     SHIPMENT     5/19/2008     182
ABC          MAW3147NC     SHIPMENT     5/26/2008     262all posdates are monday dates?
any ideas?

In other words that monday is missing from the original data set, so you are missing mondays and want to recover them by copying the data down from the last existing monday.
Here's some code that you can modify that will do just that. SEQ_WITH_GAPS and X correspond to the original data with gaps, while SEQ_WITH_NO_GAPS and COPY is the data you are looking for. You just need to define the source of your filler data to provide all the dates of interest and join it to your POS_DATE column and replicate the copy column for each of the columns of your original data that you want to copy.
WITH mydata AS
    ( SELECT level x, sum(level) over (order by level) seq_with_gaps
        FROM dual CONNECT BY level < 5
  , filler AS
    ( SELECT level seq_with_no_gaps FROM dual CONNECT BY level <= 12
SELECT seq_with_gaps
  , x
  , seq_with_no_gaps
  , last_value( x ignore nulls ) over( order by f.seq_with_no_gaps ) copy
   FROM mydata d
RIGHT JOIN filler f
     ON d.seq_with_gaps=f.seq_with_no_gaps
SEQ_WITH_GAPS    X                     SEQ_WITH_NO_GAPS    COPY                
1                1                     1                   1                   
                                       2                   1                   
3                2                     3                   2                   
                                       4                   2                   
                                       5                   2                   
6                3                     6                   3                   
                                       7                   3                   
                                       8                   3                   
                                       9                   3                   
10               4                     10                  4                   
                                       11                  4                   
                                       12                  4                   
12 rows selected

Similar Messages

  • Fill-the-gap with multiple gaps - show right answers colored

    Hello,
    I'm using CP5 on OSX 10.6.4
    I create a quiz "fill-the-gap" with multiple gaps (textfields/drop-down menu) in a single slide.
    When a user doesn't fill all gaps he get the info, that he have to fill all gaps. O.K.
    When he fills wrong answers he get the info, that it is not correct. But he can't see, which answers are right answers.
    Has CP5 (i.e with a variable) the feature to color right answers (i.e the font turns to green) others turns to red?
    Or right answers turns to non-editable textfields or drop-downs aren't available after setting the right answer.
    Ishan

    Hello,
    I never used CP5 on Mac, just on Windows. So I'm not totally sure my answers will apply.
    About your question to see the right answers: normally this will be done during Review, provided you did allow Review in the Quiz Settings (Allow the user to review the Quiz). You can see the message that will be showed when selecting the Review area on the stage and looking at the Properties. The messages can be edited. In the screenshot you see the default messages. For an incorrect answer both the given answer ('Your answer:...')  and the correct answer will be put in the Review area during review.
    For your second questions: as far as I know, this is not possible with the default dropdown list of the Question slide for 'Fill-in-the-Blank'. It could be made possible by constructing your own Question slide, using the available objects, user variables and advanced actions.
    Lilybiri

  • Numbers: how do I turn on the feature that fills the cell with typing that was previously used? The previous version had this feature. I could type the first letters of a name in a cell and the entire name would automatically appear.

    Numbers: how do I turn on the feature that fills the cell with typing. In the previous versions, I could type a name or word and then a list of names/words with the same letters would appear. I could choose the name/word to enter into the cell. This saved many strokes. If I was typing a word with only one like it previously entered, that word would appear, grayed, and I could simply tab to the next cell, automatically entering that word in that cell. Is this feature in this version of Numbers? The autofill tab 1)I can't turn it on and 2) it doesn't seem to do the same thing.
    Thanks.

    The developers failed to propagate that feature from version 2 to version 3. I believe it is on the short list of things to be restored in May 2014 or so.
    Here's the full list as published by Apple:
    Numbers
    Customize toolbar
    Improvements to zoom and window placement
    Multi-column and range sort
    Auto-complete text in cells
    Page headers and footers
    Improvements to AppleScript support
    Jerry

  • In sm30, when save, how to fill the table with the system data in the table

    Hi all, in SM30, we have user name and time fields, when we create record, after we click the SAVE button, it will automatically fill the fields with the system data, how can we realize it?

    Hi ,
    Do like this.
    1. Go to SE11 -> give your table name and press on change button .
    2.Go to Menu->Utilities-> Table Maintainance Generator , then it will take you another screen .
    3.Assign Functin group if already have one , other wise create function group and assign
    4.Go to Menu->Environment->Modification->Events , again it will take you to another screen
    5.Click on new entries
    ->Now press F4 in T column . Select<u> "01" - Before saving the data in the database</u> and in form routinue give any name of the routinue like "SAVE_USER_DATA" and press enter then u can see an editor symbol in next column click on that it will take you ABAP editor there type this code .
    ztable-username = sy-uname.
    ztable-createtime = sy-uziet.
    check and activate the code .
    With this your job will be complete . Now while entering data just leave columns blank , they will insert corresponding username and time
    Don't forget award points if it helps you.
    Regards,
    Raghav

  • Fill the LOV with data during the execution

    Hi
    I am using Oracle 10g
    I want to ask please if there is a way to fill the LOV with data during the execution
    so can I change the query specified in LOV wizard during the execution and get a new record set according to the value in the text boxes
    thank you for help

    You can use the SET_LOV_PROPERTY built-in to change the record group of the LOV and to create a new record group you can use the CREATE_GROUP_FROM_QUERY built-in.
    it will be something like this.
    RG_ID := FIND_GROUP('<record group name>');
      IF NOT ID_NULL(RG_ID) THEN
           DELETE_GROUP(RG_ID);
      END IF ;
      RG_ID := CREATE_GROUP_FROM_QUERY('<record group name>', '<your SQL statement here>');
      POP_GROUP := POPULATE_GROUP('<record group name>');
      SET_LOV_PROPERTY('<LOV name>', GROUP_NAME, '<record group name>');Use the online help for more information about these built-ins.
    Tony

  • Each time master data full load removes previous data and load with new ?

    We load company code (0COMP_CODE) master data (full load).
    1st day, we check company code master data, the record count is 150, 2nd day, the record count is 90.  It sounds like the master data full load each time would clean the previous data and load with new data, am I right?  If what I guess is right, then what setup is controlling this?
    Thanks

    I dont think it does cleanup.
    MD records in the new load simply overwrite the records already present in the master data.
    I mean if same record comes again its overwritten.If new record it gets added.
    I wouldnt expect number of records to reduce drastically from 150 to 90.
    Maybe before MD activation records could be more(as there will be both M(modified) and A(active) records).
    cheers,
    Vishvesh

  • For unknown reasons iTunes will no longer open.  I have an HP laptop running windows 7 with Kaspersky protection.  It worked fine before but now won't open.  I tried downloading the most recent up-date and it will still not open.  Any suggestions?

    For unknown reasons iTunes will no longer open.  I have an HP laptop running windows 7 with Kaspersky protection.  It worked fine before but now won't open.  I tried downloading the most recent up-date and it will still not open.  Any suggestions?

    thrillhousecody
    Thanks for the reply with additional information.
    Recent history for Premiere Elements points to the program having problems when more than 1 video card/graphics card is
    being used by the computer on which Premiere Elements is running. This observation may seem contra indicated by the fact
    that you say that the program did work well about 2 years ago in the same setup. But other factors may have set in with regard
    to drivers, drivers versions, and driver conflicts. But this factor, does need to be ruled in or out.
    Can you disable one or the other card to determine the impact of this on your problem?
    But, of prime concern with regard to video card/graphics card is the use of a NVIDIA GeForce card with Premiere Elements 10.
    Even if your NVIDIA GeForce were the only card, Premiere Elements 10 will not work properly unless the NVIDIA GeForce driver
    version is rolled back to about May 2013. This may be one of the major factors here.
    a. Device Manager/Display Adapters and find out Driver Version and Driver Date
    b. Read the background information for the Premiere Elements 10/NVIDIA GeForce issue
    ATR Premiere Elements Troubleshooting: PE10: NVIDIA Video Card Driver Roll Back
    Also see the Announcement at the top of this forum regarding the matter - also with full details of the situation and how to fix with the
    driver version roll back.
    Please review and consider and then we can decide what next.
    Thanks.
    ATR
    Add On...This NVIDIA GeForce situation is specific for Premiere Elements 10. You should not expect to see the problem for
    later versions of Premiere Elements.

  • Converting part of the string to a date and subtract with sysdate.

    HINT! In order solve this you must know how the pnr is assembled. Study this:
    650323-5510, we only need the first six characters. They inform us about when the person (car owner) was born. In this case it is 23 Mars 1965. You have to use several oracle built-in-functions to solve this. Hint! Begin by converting part of the string to a date and subtract with sysdate.
    select to_char(to_date(cast(pnr,'YYMMDDMM'))) from car_owner;
    please what am i doing wrong. i need the result to be something like this
    Hans, Rosenboll, 59,6 years.

    Hi.
    The main problem here is you have only last two digits of year. That could be the problem in a couple of years from now, when somebody born after 2k would get in to your database. For now if we ignore this problem the right solution would be :
    <code>
    SELECT months_between(trunc(SYSDATE),
    to_date('19' || substr('650323-5510',
    1,
    6),
    'YYYYMMDD')) / 12 years_old
    FROM dual
    </code>
    Suppose you are expecting the age of the car owner as a result above code will give you that. One again notice the '19' I appended.
    Best regards.

  • Problem with different resultset with same data and same query in Oracle 8.1.7 and 9i

    Hello,
    I have been using this query in oracle 8.1.7
    SELECT
    ID,
    AREA_NO
    FROM MANAGER_AREA MGR
    WHERE COMPANY_ID = :id AND
    (:value < (SELECT COUNT(ROWID)
    FROM MANAGER_WORK MW
    WHERE MW.AREA_ID = MGR.ID AND
    (MW.END_WORK IS NULL OR MW.END_WORK >= SYSDATE)))
    order by AREA_NO;
    In the above query I want to see rows from MANAGER_AREA table depending upon date criteria in the table MANAGER_WORK and also upon the parameter :value i.e if I pass a value as 0 I get to see records for which their is atleast 1 record in MANAGER_WORK with the date criteria and if I pass -1 then I get all the records because minimum value that count(*) would give is 0. The resultset was as expected in 8.1.7.
    A couple of days back I installed PERSONAL 9i to test for testing the basic functionality of our program with the same data. This query fails and irrespective whether I pass -1 or 0 it returns me same dataset which I would have got in case if I pass 0.
    I do not know whether this is a bug that has got introduced in 9i. Can anybody help me with this problem. It would be difficult for me to change the parameter send to this query as the Query is called from many different places.
    Thanks in advance
    Amol.

    I cannot use a Group by and a having statement over here. The problem with 'Group by' and 'having' clause is If I have to make a join between the two tables. When I use join then I get only rows that are linked to each other in the table.
    If I use outer join to solve that problem then I have to take in consideration the other date condition. My previous query use to virtually discard the corelated query result by using -1 as the value. This will not happen in the join query.
    Amol.

  • Taking long time filling the setup tables for sales and shipment

    Hi ,
    I am trying to fill the setup tables for sales and shipment and it is taking lot of time .
    It took 16 hours just to bring 6 months of  sales history  data in the test environment .
    Cn anybody help on this issue why it is taking that much of time ...
    I am trying to  load the sales data from R/3 into APO-BW from 2005 to 2007 .......
    It is taking 16 hours to fill the data for only 6 months .

    Hi,
    1. delete data and refill the setuptables again by spliting to several small pieces.
    2. compare the data. wht is the last Document numner in RSA3(Maximum one). Start from Maximum one. may be bit complex approch.
    you need to check with PSA and base tables.
    keep one thing in your mind you need to check againest MSEG and BSEG only. noy BKPF and MKPF.
    correct if i'm wrong.
    either refill or create a user exit to avoid duplicae records(you should have very good understanding of data, it will lead to inconsitent data for delta records).
    User exit not a good solution. it's one possibility.
    ****Assign Points If Helpful****
    Regards,
    Ravikanth

  • Explan the methods to fill the gaps in abap ?

    Hi I am newly appoined in abap mine role is to fill the gaps between clinet and us 
    explain me with fine example ? THis is very help ful to me in my life... thanking U

    Can you be more clear on what you need help??

  • How can I make the popup with empty fileds and create new record?

    I would like to use a popup to create new record.
    I created a af:popup by drag and drop a VO from data control to jsff. then, I created a button and place a af:showPopupBehavior. I was able to popup window by click the button.
    however, the window filled with the information from the 1st record. and when I select a record in table and click popup, the popup is filled with that record.
    How can I make the popup with empty fileds and create new record by saving the popup?
    Thanks

    You can have edit and new buttons, in the PopupFetchEvent identify button source (using popupFetchEvent.getLaunchSourceClientId()) if new button clicked clear the binding using below code.
    If you want to see empty fields, in the popup PopupFetchEvent clear the input component bindings.
    resetBindingValue("#{bindings.<componentid>.inputValue}", null);
        public static void resetBindingValue(String expression, Object newValue) {
            FacesContext ctx = FacesContext.getCurrentInstance();
            Application app = ctx.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = ctx.getELContext();
            ValueExpression valueExp = elFactory.createValueExpression(elContext,expression,Object.class);
            Class bindClass = valueExp.getType(elContext);
            valueExp.setValue(elContext,newValue);
        }

  • How to fill selection box with clientside data?

    i want to make a html form that reads option values from the client.
    Because there are too many data, it's not reasonable for me to design a page which connects to server each time to fill the selection boxes.Instead i want to check if data resides at the clientside, if so fill selection boxes with that data, if not download it for the first time and store it on the client for later local retrieval.In addition i must be able to update that data residing on the client when i want.

    Hi,
    I can tell you some hints. Use cookies to store the information on to the client-side. You can read data from cookies using JavaScript. If you want to store huge amount of data on to the client-side, perhaps this would not be a better idea. In J2EE architecture we often use sessions to store values. You need to design your implementation in such a way that for the first time you fetch all the values from the database and put it in a session, and the next time onwards you can get the values from the session itself and thereby you can avoid going to database each and everytime. Write a Java class which has all the necessary get and set methods and store the object in the session. Using that object reference you can set and get the values from it. I hope this will help you.
    Thanks

  • Filter the field with people data picker

    hi
    1.i create the list and put the internal number for each persone
    now I have another list that customized it with InfoPath 2010
    I want in the form when the user inter the internal number in it's field the field that is for the person appeared itself
    I create the data connection and filter the field with display name
    and when preview the form ir works but in the sharepoint list it doese'nt work when I filter it with the field=[me]
    and when preview the form in InfoPath after the display name there is 3 #
    and I thins these # is the problem
    plz help me
    thanks

    Hi ,
    According to your description, my understanding is that you want to fill automatically the person column in the second list based on the internal number.
    I did a test as the followings:
    Create a list called ListA, and add two column: internal number(single line of text), person(Person&Group).
    Add some items into the ListA.
    Create another list called ListB, and add two column: internal number(single line of text), personB(Person&Group).
    Customize ListB with InfoPath, and click the column “internal number”.
    Set a rule for the column as the screenshot.
    After the above, I tested in ListB, it worked well.
    Then I set a filter personB=[me], it also worked well.
    Please have a try as my steps, compare the result.
    Thanks,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Fill The Page with ONE Picture

    I would like to figure a way to fill the whole page with just one picture for my Home Page other than the various page links at the top. iWeb will only allow me to size the pic to about 50% of the page give or take. Does anyone know how I can get it to fill the entire screen?

    Create and publish your page.
    Open the page in a HTML Editor of your choice and paste this line at the top of the <body>.
    +<object width="100%" height="100%" data="url/to/your/picture.jpg" type="image/jpeg" style="position: fixed; top: 0px; left: 0px;"></object>+
    The image will scale when you resize the browser window.
    To get the idea, see this page:
    http://web.mac.com/wyodor/helloworld/helloworld.html
    It's not made in iWeb, but it will work there too.

Maybe you are looking for

  • Can you import video directly from a video camera ?

    Can you import video directly from a video camera to the iPad 2 ? If so, what is needed?

  • In standard text

    hai how to convert text from uppercase to lowercase. and lowercase to uppercase.

  • Why did firefox change yahoo home page. Now different from IE

    For some reason the Yahoo home page which I always use has been changed on Firefox. On IE it is the good old home page that I not only like but was used to. I prefer Firefox as my browser but would like the regular Yahoo home page back. Any ideas?

  • Multiple iTunes on NAS

    I know I can share playlists, but am planning a central data drives for all three Macs at home with everybody's iTunes on it (by aliasing from their users account). When my son is booted into windows on his intel Mac, will we still be able to share h

  • How do I learn to & Making an i-phone app ??

    Ok I've researched a bit online but I dont want to pay out money to the wrong thing. Do I need to join the developer program for $99? Is there UK version ? I have limited web design experience but someome else usually does the tech bit whilst I point