How to fill the gaps with data?

Hello

I have data points with a header that contains the ID that I have to report to each row of data.

I want the ID of the Patient to fill the fields below the rank (where the "Obs" and sequential numbers are) until it reaches the next patient id and then do the same thing again and again until the end.

Is this possible in a single SQL UPDATE statement?

Thank you, Daniel

It's data, it's a column:

Patient ID = system 1000207 = LVS + ZDV + ddI randomization Date = 26/03/2004
OBS
1
2
3
4
5
6
7
Patient ID = regime 1000751 = LVS + d4T + 3TC randomization Date = 25/02/2004
OBS
8
9
10
11
12
13
14
Patient ID = system 1001379 = LVP + d4T + 3TC randomization Date = 17/03/2004
OBS
15
16
17
18
19
20
21
22
23
24
etc etc.

Do you have any column order?

If not, how you will order the data?

If you have a column for the classification, the described selection will give you the id of the patient in all lines

select col1,
       last_value(
          regexp_substr(col1,'Patient ID=([0-9]+)',1,1,null,1) ignore nulls
                )
        over(order by ord_col) s
from your_table;

You can then use the MERGER based on the ROWID of update...

Published by: JAC on May 21, 2013 20:18

Tags: Database

Similar Questions

  • to fill the gaps with value of lead and the delay and make average and the gap between earned

    Thanks in advance

    I have table as below
    ID          TYPE     NUM     NAME     BEG_MP     END_MP     VALUE
    10001103N     3     1190001     WST     0.000     0.220     
    10001103N     3     1190002     WST     0.220     0.440     
    10001103N     3     1190003     WST     0.440     0.820     12800
    10001103N     3     1190003     WST     0.820     1.180     12800
    10001103N     3     1190004     WST     1.180     1.220     
    10001103N     3     1190004     WST     1.220     1.300     
    10001103N     3     1190005     WST     1.300     1.420     14800
    10001103N     3     1190005     WST     1.420     1.550     14800
    10001103N     3     1190006     WST     1.550     2.030     
    10001103N     3     1190006     WST     2.030     2.660     
    10001103N     3     1190007     WST     2.660     2.780     
    What I need is to fill the gaps with value of lead and the delay and make average and the gap between the values
    ID          TYPE     NUM     NAME     BEG_MP     END_MP     VALUE
    10001103N     3     1190001     WST     0.000     0.220     12800 ---> Lag value
    10001103N     3     1190002     WST     0.220     0.440     12800 ---> Lag Value
    10001103N     3     1190003     WST     0.440     0.820     12800
    10001103N     3     1190003     WST     0.820     1.180     12800
    10001103N     3     1190004     WST     1.180     1.220     13800 ---> Avg(12800,14800)
    10001103N     3     1190004     WST     1.220     1.300     13800 ---> Avg(12800,14800)
    10001103N     3     1190005     WST     1.300     1.420     14800
    10001103N     3     1190005     WST     1.420     1.550     14800
    10001103N     3     1190006     WST     1.550     2.030     14800 ---> Lead Value
    10001103N     3     1190006     WST     2.030     2.660     14800 ---> Lead Value
    10001103N     3     1190007     WST     2.660     2.780     14800 ---> Lead Value
    create table AVG_TABLE
    (
      ID     VARCHAR2(20),
      TYPE   NUMBER,
      NUM    NUMBER,
      NAME   VARCHAR2(10),
      VALUE  NUMBER,
      BEG_MP NUMBER(6,3),
      END_MP NUMBER(6,3)
    )
    ;
    
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190001, 'WST', null, 0, .22);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190002, 'WST', null, .22, .44);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190003, 'WST', 12800, .44, .82);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190003, 'WST', 12800, .82, 1.18);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190004, 'WST', null, 1.18, 1.22);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190004, 'WST', null, 1.22, 1.3);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190005, 'WST', 14800, 1.3, 1.42);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190005, 'WST', 14800, 1.42, 1.55);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190006, 'WST', null, 1.55, 2.03);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190006, 'WST', null, 2.03, 2.66);
    insert into AVG_TABLE (ID, TYPE, NUM, NAME, VALUE, BEG_MP, END_MP)
    values ('10001103N', 3, 1190007, 'WST', null, 2.66, 2.78);
    commit;

    Hello

    Use LEAD and LAG when you know exactly how far is the target line (for example, if you know the desired value is on the next row).
    If you don't know exactly how far is the target line, then FIRST_VALUE and LAST_VALUE are more likely to be useful.

    WITH     got_neighbors     AS
    (
         SELECT     avg_table.*
         ,     LAST_VALUE (value IGNORE NULLS) OVER (ORDER BY beg_mp)          AS prev_value
         ,     LAST_VALUE (value IGNORE NULLS) OVER (ORDER BY beg_mp DESC)     AS next_value
         FROM     avg_table
    )
    SELECT       id, type, num, name, beg_mp, end_mp
    ,       COALESCE ( value
                 , ( NVL (prev_value, next_value)
                   + NVL (next_value, prev_value)
                   ) / 2
                 )     AS value
    FROM       got_neighbors
    ORDER BY  beg_mp to f
    ;
    

    Riedelme is correct: LAG LEAD (as well as FIRST_VALUE and LAST_VALUE) can return only the values that are there (or that you give as default values). This means that you can not solve this problem with these functions alone; you need something else (as NVL, above) to provide value when the function does not find it.

  • How to fill the canvas with lines

    < mx:Canvas id = "b1" x = "10" y = "10" height = "40" width = "300" borderStyle = "solid" borderColor = "black" / >

    When I want to draw lines with difference of 15 pixels to fill the entire canvas I wrote the following

    for (var i: int = b1.x + 15; i < b1.x + b1.width; i = i + 15)
    {
    var line1:UIComponent = new UIComponent();
    var lineThickness1:Number = 1;
    var lineColor1:Number = 0 x 000000;
    var lineAlpha1:Number = 1;
    LINE1. Graphics.LineStyle (lineThickness1, lineColor1, lineAlpha1);
    LINE1. Graphics.MoveTo (i, B1.y);
    LINE1. Graphics.LineTo (i, B1.y + B1. Height);
    this.addChild (line1);
    }

    It works very well

    LLY,

    < mx:Canvas id = "b4" x = "600" y = "200" height = "60" width = "300" borderStyle = "solid" borderColor = rotation "black" = "40" / >

    I have the canvas above with the "b4" id only difference is that this canvas rotation

    How to fill the canvas with lines that I just did above?

    Hope this code will help you,

    for(var i: int = 15; i < b4.width; i = i + 15) {
         var line1: UIComponent = new UIComponent();
         var lineThickness1: Number = 1;
         var lineColor1: Number = 0x000000;
         var lineAlpha1: Number = 1;
         line1.graphics.lineStyle(lineThickness1, lineColor1, lineAlpha1);
         line1.graphics.moveTo(i, 0);
         line1.graphics.lineTo(i, b4.height - 1);
         //Add line in canvas instead of main container
         b4.addChild(line1);
    }
    
    
    
  • How to fill the DataGird with the data returned by the php page?

    Hi, I'm new to Flex, I try to fill DataGrid with data from PHP, my code is

    < mx:HTTPService

    id=" personRequest = URL "result ="getPerson (event)" http://localhost/searchPerson.php " useProxy = ' fake "method =" " POST "

    showBusyCursor ="

    true "resultFormat =" " E4X " >

    < /.

    MX:HTTPService >

    < mx:DataGrid

    id=" searchResult " " dataProvider =" {? what to paste here? } }" y="30"

    >

    < / mx:DataGrid >

    .....

    private

    function getPerson(evt:ResultEvent):Sub { }

    var res: XMLList = evt.result... Dane as XMLList;

    search results =

    new (Res) XMLListCollection;

    }

    ....

    output of PHP

    < person >

    < dane >

    < name > CBA < / name >

    < Street > XLXXLX < / street >

    < / dane >

    < dane >

    < name > DEF < / name >

    < Street > CIWU < / street >

    < / dane >

    < / person >

    If I set the dataProvider as search results "" it doesn't work. I have probably set all collection ArrayCollection as a dataprovider, but I don't know how to convert my XMLListCollection for her.

    Could someone help me complete Datagrid with

    name | Streer

    ABC, XLXXLX

    DEF, CIWU

    Best regards

    Mariusz










    After the datagrid control, you post the above code.

  • How to fill the text with transparent areas

    I use Adobe Photoshop CC 2015 on Windows 10.  I am trying to create a transparent logo using fonts "Mister Vampire".  The text has some areas transparent I am filling to create a Chrome or gold.

    Here is an example of the police.  Any help is appreciated.

    Text Sample.JPG

    Several ways. You can use the magic wand tool to select the transparent areas in the text: use contiguous, then move click here to make the next letter. You should maybe put a white layer below the sample text and use all layers. Extend selection when done and fill a layer below the text with the desired color.

  • How to use the aggregate with Date function

    Hi all

    I have a Group date is it possible of Max and Min to date.

    I tried like this but its out errored <? MIN (current - group () / CREATION_DATE)? >.

    I also tried this, but it does not work
    <? xdoxslt:minimum (CREATION_DATE)? >

    Is it possible to use the function of aggregation with date values.

    Thanks and greetings
    Srikkanth

    You can use
    Ensure that the "date" is in canonical format

  • How to fill a ComboBox with data from a Web service

    I have a simple application that contains a DataGrid control that gets its data from a web service. I prefer to put these data in a ComboBox instead of a DataGrid control. My web service returns objects.

    Someone has an idea how to do?

    < mx:DataGrid id = dataProvider = "{ws.getProjects.lastResult"dgProjects"}" > "
    ... < mx:columns >
    ... < mx:DataGridColumn dataField = "projectID" headerText = "ID of project" width = "100" / >
    ... < mx:DataGridColumn headerText = "Project name" dataField = "projectName" / >
    ... < mx:DataGridColumn headerText = "Doc UNID" dataField = "docUNID" visible = "false" / >
    ... < / mx:columns >
    < / mx:DataGrid >

    Exactly what I needed.

    Thank you very much!!!

  • How to fill the screen with custom display fields

    I need to instantiate a class of custom field and add it to a number fixed times who knows @ length of the screen.

    I created a table to create objects of a custom field, and then I add elements to the screen one by one.

    I use this code where the entries knows @ runtime.

    There is error but the fields are not added to the screen and the screen and the screen is blank.

    CustomField item[]=new CustomField[entries];
    int entries;
    for(int i=0;i			 

    Some stupid problem just to retrieve the integer. Now, copy the following code works correctly.

  • How to fill a field of date with today's date when the signature field is signed?

    How to fill a field of date with today's date when the signature field is signed? In the LCD, I insert a signature field and a date field, what parameters in these two fields are necessary to make this work? Is the date field, the value calculated? I tried different JS suggestions I found, but none work. In the form, I named the signature ClaimSignature field and the date in the ClaimSigDate field.

    The thought of her with a little help. In the script editor window, I selected the postSign event and added the following JS:

    Form1.Page1.ClaimSignature::postSign - (JavaScript, client)

    var date = new Date();

    var day = date.getDate ();

    var month = date.getMonth () + 1;

    var monthstring = (month, 10?) ('0' + month: month)

    year var = date.getFullYear ();

    var = year DateString + '-' + monthString + '-' + (day< 10="" "0"="" +="" day="" :="">

    ClsimSigDate.rawValue = dateString;

    I hope this helps someone else save time.

  • How to call the property with variable

    Basically, I want to fill a table with data

    photoArray [count] = varLoader.data.nombre;

    the problem is that 'number' is supposed to be a variable is inside a loop and I "number ="peak"+ count;" before him, but it does not work, how do I call?

    table rating to coerce strings to objects:

    photoArray [count] = varLoader.data [number];

    or

    photoArray [count] = varLoader.data ["peak" + count];

  • How to fill one shape with another shape, but not of models

    Hello

    How to fill one shape with another shape, but not of models. Example of this poster

    Screen Shot 2015-05-18 at 13.41.33.png

    put in a shape of the tree so that it looks like this:

    Heavy_type_tree.jpg

    Select your type with a vector path, which is the subject

    Object > envelope distort > make with top object.

  • How to change the Rectangles with buttons

    I'm working on this example that does not work correctly:

    public class test extends Application
    {
    
        private void init(Stage primaryStage)
        {
    
            Group root = new Group();
            primaryStage.setScene(new Scene(root));
    
            String pillButtonCss = DX57DC.class.getResource("PillButton.css").toExternalForm();
    
            // create 3 toggle buttons and a toogle group for them
            ToggleButton tb1 = new ToggleButton("Left Button");
            tb1.setId("pill-left");
            ToggleButton tb2 = new ToggleButton("Center Button");
            tb2.setId("pill-center");
            ToggleButton tb3 = new ToggleButton("Right Button");
            tb3.setId("pill-right");
    
            final ToggleGroup group = new ToggleGroup();
            tb1.setToggleGroup(group);
            tb2.setToggleGroup(group);
            tb3.setToggleGroup(group);
            // select the first button to start with
            group.selectToggle(tb1);
    
            //////////////////////////////////////////
    
            final VBox vbox = new VBox();
    
            final Rectangle rect1 = new Rectangle(300, 300);
            rect1.setFill(Color.ALICEBLUE);
            final Rectangle rect2 = new Rectangle(300, 300);
            rect2.setFill(Color.AQUA);
            final Rectangle rect3 = new Rectangle(300, 300);
            rect3.setFill(Color.AZURE);
    
            tb1.setUserData(rect1);
            tb2.setUserData(rect2);
            tb3.setUserData(rect3);
    
            group.selectedToggleProperty().addListener(new ChangeListener<Toggle>()
            {
                @Override
                public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle)
                {
                    if (new_toggle == null)
                    {
                        //rect.setFill(Color.WHITE);
                    }
                    else
                    {
                        vbox.getChildren().addAll((Node[]) group.getSelectedToggle().getUserData());
                        //rect.setFill((Color) group.getSelectedToggle().getUserData());
                    }
                }
            });
    
    
            ///////////////////////////////////////////
    
    
            HBox hBox = new HBox();
            hBox.getChildren().addAll(tb1, tb2, tb3);
            hBox.setPadding(new Insets(20, 20, 260, 20));
            hBox.getStylesheets().add(pillButtonCss);
    
    
    
            vbox.getChildren().add(hBox);
            //vbox.getChildren().add(rect);
    
            root.getChildren().add(vbox);
        }
    
        @Override
        public void start(Stage primaryStage) throws Exception
        {
            init(primaryStage);
            primaryStage.show();
        }
    
        public static void main(String[] args)
        {
            launch(args);
        }
    }
    
    
    

    I want to create several Rectangles (or in which object or object) in which I want to store data. I want to spend the Rectangles (objects) that appear in front of the user by using the buttons. The example that I put in place does not work correctly. Can you tell me what is the right way to implement this?

    REF javafx 2 - How to change the Rectangles with buttons - stack overflow

    You have two problems:

    User data that assign you to each button switches are a node, not a [Node]. Thus, the cast will fail on line 43.

    When the selected toggle changes, you add another Rectangle to the vbox. You want to replace the rectangle that is in the vbox.

    Try

    vbox.getChildren () .setAll ((Node) group.getSelectedToggle () .getUserData ());

  • Fill the shape with text

    Whether you have a shape, a triangle and you want to write text inside, if the pile of words on top of each other like a pyramid. Who would you do? When you use the text tool, you can drag a text box, but I want a triangle of text, or a star or another strange form. How to fill a shape with text?

    Why?

    I do not mean to be a five-year-old; I'm asking because there may be a way to get the desired result in a different way.

    For example, if you are wanting to use animations of text, John Dickinson explained how to do this:

    'Export' your Illustrator file in Photoshop (.psd) format.

    Then open the .psd in After Effect in the form of Composition

    Select the text layer and choose layer > convert to editable text.

  • How to play the song with .wma extension

    How to play the song with .wma extension

    If it does not DRM, use VLC. If so, no Mac OS X software can play or convert.

    (142864)

  • How to fix the error with the code: 0xe7210001 failed to load powrprof, object: cls

    Hello

    Dose anyone know how to fix the error with the code: 0xe7210001, message: unable to load powrprof, object: CLSD-no-it is found;
    OR: Fingerprintsoftware OR error: replicas THotkey.exe message window and the computer freezes

    Maleware scanned and virus, also in safe mode, found no infection, reinstalled driver fingerprint, but nothing has changed.

    grateful for the help!

    Hello

    > message: unable to load powrprof, object: CLSD-no-it is found;
    In my view, this would mean that there is a problem with Toshiba Power Saver
    What laptop Toshiba, you have exactly?

    Maybe reinstall Power Saver could help. You can find it on the official website of Toshiba.

Maybe you are looking for