Populate table with repartitions

Hello everyone,
I would like some input on a problem to which I cannot seem to find a proper solution.
I have five tables:
Halls (_hall_, nr_places, nr_extra_places);
Students (_id_student, name, major, year );
Exams (year,major,id_subject,date_exam ,hour);
Halls_exams (hall, date_exam, hour, id_subject);
Repartition_exams (id_student, id_subject, date_exam, hour, hall);I’m trying to create a procedure or function to populate the fifth table (repartitions_exams) with students, repartitions for exams per halls and hours.
It is important to keep in mind the number of places from each hall and at the same time, a hall must have students of the same year, major and id_subject, sorted alphabetically.
I have tried solving this using a cursor but I failed in making it a viable solution.
If you could give me any hints or possible solutions to this I would highly appreciate it.
Thank you in advance,
Ella
-----edit
these are the tables and inserts that I worked on...I apologize for any mistakes. I had to translate and to remove some columns that were irrelevant to the issue.
create table halls(
hall varchar(4) constraint pk_halls_hall primary key,
nr_places numeric(4),
nr_extra_places numeric(2)
create table students(
id_student varchar(20) constraint pk_students_id_student primary key,
name varchar(30),
year numeric(4),
major varchar(20)
create table exams(
year numeric(4),
major varchar(20),
id_subject numeric(4),
date_exam date,
hour numeric(2),
constraint pk_exams primary key(year,major,id_subject,date_exam)
create table halls_exams(
hall varchar(4) constraint fk_halls_exams_hall references halls(hall),
date_exam date,
hour numeric(2),
id_subject numeric(4),
constraint pk_halls_exams primary key(hall,date_exam,hour)
create table repartition_exams(
id_student varchar(20) constraint fk_repart_exams_id_student references students(id_student),
id_subject numeric(4),
date_exam date,
hour numeric(2),
hall varchar(4) constraint fk_repart_exams_hall references halls(hall),
constraint pk_repart_exams primary key(id_student,id_subject,date_exam)
insert into halls(hall,nr_places,nr_extra_places) values ('B1',10,2);
insert into halls(hall,nr_places,nr_extra_places) values ('B3',10,2);
insert into halls(hall,nr_places,nr_extra_places) values ('B4',12,2);
insert into students(id_student,name,year,major) values ('pm095631','name1',2,'IE');
insert into students(id_student,name,year,major) values ('pm095632','name2',2,'IE');
insert into students(id_student,name,year,major) values ('pm095633','name3',2,'IE');
insert into students(id_student,name,year,major) values ('pm095634','name4',2,'IE');
insert into students(id_student,name,year,major) values ('pm095635','name5',2,'IE');
insert into students(id_student,name,year,major) values ('pm095636','name6',2,'IE');
insert into students(id_student,name,year,major) values ('pm095637','name7',2,'IE');
insert into students(id_student,name,year,major) values ('pm095638','name8',2,'IE');
insert into students(id_student,name,year,major) values ('pm095639','name9',2,'IE');
insert into students(id_student,name,year,major) values ('pm095640','name10',2,'IE');
insert into students(id_student,name,year,major) values ('pm095641','name11',2,'IE');
insert into students(id_student,name,year,major) values ('pm095642','name12',2,'IE');
insert into students(id_student,name,year,major) values ('pm095643','name13',2,'IE');
insert into students(id_student,name,year,major) values ('pm095644','name14',2,'Ai');
insert into students(id_student,name,year,major) values ('pm095645','name14',2,'Finances');
insert into students(id_student,name,year,major) values ('pm095646','name15',2,'Ai');
insert into students(id_student,name,year,major) values ('pm095647','name16',2,'Ects');
insert into students(id_student,name,year,major) values ('pm095648','name17',2,'Ects');
insert into exams(year,major,id_subject,date_exam,hour) values (2,'IE',115,TO_DATE('15/10/10','DD/MM/YY'),12);
insert into exams(year,major,id_subject,date_exam,hour) values (3,'IE',125,TO_DATE('16/10/10','DD/MM/YY'),14);
insert into exams(year,major,id_subject,date_exam,hour) values (1,'IE',135,TO_DATE('17/10/10','DD/MM/YY'),10);
insert into exams(year,major,id_subject,date_exam,hour) values (3,'IE',145,TO_DATE('18/10/10','DD/MM/YY'),18);
insert into halls_exams(hall,date_exam,hour,id_subject) values ('B1',TO_DATE('15/10/10','DD/MM/YY'),12,115);
insert into halls_exams(hall,date_exam,hour,id_subject) values ('B3',TO_DATE('15/10/10','DD/MM/YY'),12,115);
insert into halls_exams(hall,date_exam,hour,id_subject) values ('B4',TO_DATE('17/10/10','DD/MM/YY'),10,135);Edited by: user11973351 on Oct 6, 2010 5:49 AM
Edited by: user11973351 on Oct 6, 2010 1:23 PM

Ella,
I think I understand what you're trying to do and the following example should work, but you may have to tweak it if some of my assumptions are incorrect.
I used the row_number analytic function to assign a seat number to each student in an exam, and analytic sum functions to assign ranges of seat numbers to each hall for an exam. Then I selected students whose seat numbers were within those ranges.
I ordered the students by id but you can order by name if you prefer. I also made an assumption that you want to assign the "extra" seats only after all regular seats have been assigned.
I included the derived seat numbers and ranges in the output to make the logic easier to follow.
Regards,
Bob
-- Generating test data...
with halls as (
select 1 as hall,10 as nr_places,2 as nr_extra_places from dual union all
select 3 as hall,10 as nr_places,2 as nr_extra_places from dual union all
select 4 as hall,12 as nr_places,2 as nr_extra_places from dual
, students as (
select 'pm095631' as id_student,'name1'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095632' as id_student,'name2'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095633' as id_student,'name3'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095634' as id_student,'name4'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095635' as id_student,'name5'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095636' as id_student,'name6'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095637' as id_student,'name7'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095638' as id_student,'name8'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095639' as id_student,'name9'  as sname,2 as yr,'IE'         as major from dual union all
select 'pm095640' as id_student,'name10' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095641' as id_student,'name11' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095642' as id_student,'name12' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095643' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095644' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095645' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095646' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095647' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095648' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095649' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095650' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095651' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095652' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095653' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095654' as id_student,'name13' as sname,2 as yr,'IE'         as major from dual union all
select 'pm095644' as id_student,'name14' as sname,2 as yr,'Ai'         as major from dual union all
select 'pm095645' as id_student,'name14' as sname,2 as yr,'Finances'   as major from dual union all
select 'pm095646' as id_student,'name15' as sname,2 as yr,'Ai'         as major from dual union all
select 'pm095647' as id_student,'name16' as sname,2 as yr,'Ects'       as major from dual union all
select 'pm095648' as id_student,'name17' as sname,2 as yr,'Ects'       as major from dual
, exams as (
select 2 as yr,'IE' as major,115 as id_subject,TO_DATE('15/10/10','DD/MM/YY') as date_exam,12 as hour_exam from dual union all
select 3 as yr,'IE' as major,125 as id_subject,TO_DATE('16/10/10','DD/MM/YY') as date_exam,14 as hour_exam from dual union all
select 1 as yr,'IE' as major,135 as id_subject,TO_DATE('17/10/10','DD/MM/YY') as date_exam,10 as hour_exam from dual union all
select 3 as yr,'IE' as major,145 as id_subject,TO_DATE('18/10/10','DD/MM/YY') as date_exam,18 as hour_exam from dual
, halls_exams as (
select 1 as hall,TO_DATE('15/10/10','DD/MM/YY') as date_exam,12 as hour_exam,115 as id_subject from dual union all
select 3 as hall,TO_DATE('15/10/10','DD/MM/YY') as date_exam,12 as hour_exam,115 as id_subject from dual union all
select 4 as hall,TO_DATE('17/10/10','DD/MM/YY') as date_exam,10 as hour_exam,135 as id_subject from dual
-- ...end of test data
select s.id_student, x.id_subject, x.date_exam, h.hour_exam, h.hall, s.rn, h.rn_min, h.rn_max,h.xrn_min, h.xrn_max
from exams x
  select date_exam, hour_exam, id_subject, hx.hall, nr_places
  , nvl(
     sum(h.nr_places) over (
       partition by date_exam, hour_exam, id_subject
       order by hx.hall
       range between unbounded preceding and 1 preceding
     ,0
     ) + 1 as rn_min
  , nvl(
     sum(h.nr_places) over (
       partition by date_exam, hour_exam, id_subject
       order by hx.hall
       range between unbounded preceding and current row
    ,0
    )     as rn_max
  , nvl(
     sum(h.nr_places) over (
       partition by date_exam, hour_exam, id_subject
       order by hx.hall
       range between unbounded preceding and unbounded following
     ,0
     +   nvl(
     sum(h.nr_extra_places) over (
       partition by date_exam, hour_exam, id_subject
       order by hx.hall
       range between unbounded preceding and 1 preceding
     ,0
     + 1 as xrn_min
  , nvl(
     sum(h.nr_places) over (
       partition by date_exam, hour_exam, id_subject
       order by hx.hall
       range between unbounded preceding and unbounded following
     ,0
     +   nvl(
     sum(h.nr_extra_places) over (
       partition by date_exam, hour_exam, id_subject
       order by hx.hall
       range between unbounded preceding and current row
     ,0
     as xrn_max
  from halls_exams hx
     , halls       h
  where h.hall = hx.hall
  ) h
, (select id_student,sname, yr, major, row_number() over(partition by yr,major order by id_student) as rn from students) s
where h.id_subject=x.id_subject
and   h.date_exam = x.date_exam
and   h.hour_exam = x.hour_exam
and   s.yr=x.yr
and   s.major=x.major
and   (s.rn between h.rn_min and h.rn_max
    or s.rn between h.xrn_min and h.xrn_max
order by s.id_student
ID_STUDENT ID_SUBJECT DATE_EXAM   HOUR_EXAM  HALL  RN  RN_MIN  RN_MAX  XRN_MIN  XRN_MAX 
pm095631   115        2010/10/15  12         1     1   1       10      21       22      
pm095632   115        2010/10/15  12         1     2   1       10      21       22      
pm095633   115        2010/10/15  12         1     3   1       10      21       22      
pm095634   115        2010/10/15  12         1     4   1       10      21       22      
pm095635   115        2010/10/15  12         1     5   1       10      21       22      
pm095636   115        2010/10/15  12         1     6   1       10      21       22      
pm095637   115        2010/10/15  12         1     7   1       10      21       22      
pm095638   115        2010/10/15  12         1     8   1       10      21       22      
pm095639   115        2010/10/15  12         1     9   1       10      21       22      
pm095640   115        2010/10/15  12         1     10  1       10      21       22      
pm095641   115        2010/10/15  12         3     11  11      20      23       24      
pm095642   115        2010/10/15  12         3     12  11      20      23       24      
pm095643   115        2010/10/15  12         3     13  11      20      23       24      
pm095644   115        2010/10/15  12         3     14  11      20      23       24      
pm095645   115        2010/10/15  12         3     15  11      20      23       24      
pm095646   115        2010/10/15  12         3     16  11      20      23       24      
pm095647   115        2010/10/15  12         3     17  11      20      23       24      
pm095648   115        2010/10/15  12         3     18  11      20      23       24      
pm095649   115        2010/10/15  12         3     19  11      20      23       24      
pm095650   115        2010/10/15  12         3     20  11      20      23       24      
pm095651   115        2010/10/15  12         1     21  1       10      21       22      
pm095652   115        2010/10/15  12         1     22  1       10      21       22      
pm095653   115        2010/10/15  12         3     23  11      20      23       24      
pm095654   115        2010/10/15  12         3     24  11      20      23       24      
24 rows selected

Similar Messages

  • Populate table with XML returned by a Web Service

    Hi,
    I have a web service that executes MulitipleRowQuiery and returns XML
    variable.
    When I set the data connection (in Designer) to this service in my
    PDF form I'm getting "document" and "element" nodes under the
    invokeResponce tree (data view palette).
    How can I use this parameters in order to traverse the XML that was
    returned by the WS?
    What I need is to populate a table with this XML data..
    Thanks, Rbuz.

    You can use the XDP as is ...it is just this forum that will not accept XDP format. I have already made th erequest to get it changed and we are waiting for the next software update.
    There are two sets of bindings for every object on a form. DataBindings allow you to import XML and bind the nodes to the fields and Execute bindings which are used with Web Services. I used your sample XML file as an input for data bindings and got it to work the way you want by using [*] in the binding instructions to indicate that more than one node was present there. This is not possible in the Execute bindings. You can only have a one to one relationship. So I do not think you can do it the way you want.
    Can you get the WS to return you the entire XML as a single parameter? If so then you could bind that parm to a hidden field, then load all of the XML into the DataDom and use Data Bindings that do support what you are trying to do. I have included a sample that shows the table being filled the way you want using data binding.
    You shoudl contact support and get an enhancement logged to get the WS bindings to act the same way.
    Hope that helps
    Paul

  • Populate table with refresh group outcome

    Hi everyone,
    I need a little help.
    I am working on an Oracle 10.2.0.4 in Windows environment.
    I have a table I created like this:
    Table name: DIM_REPLICA
    COD_SEZ VCHAR2(2)
    NOME_SEZ VCHAR2(20)
    FLAG CHAR(1)
    D_REPLICA DATE
    On this DB I have 210 refresh groups executing every night. I need to populate this table with the outcome of the refresh groups.
    So when the refresh group called for example ROME runs I need written on the table the name ROME in the "NOME_SEZ" field, a Y or a N if the refresh group worked correctly in the FLAG field and the LAST_DATE the refresh group ran in the D_REPLICA field. The COD_SEZ field is a code I get from other things. It is not needed at the moment. I can add it myself on me own.
    Can anyone please help me?
    I was looking on SYS tables DBA_JOBS and DBA_REFRESH for this data, but I am not sure what to take and how to populate the table. Trigger? Procedure? Any help will be great!
    Thank you all in advance!

    Hi Phelit,
    After update trigger may help you with few customization
    Refer sample code
    CREATE OR REPLACE TRIGGER orders_after_update
    AFTER UPDATE
       ON orders
       FOR EACH ROW
    DECLARE
       v_username varchar2(10);
    BEGIN
       -- Find username of person performing UPDATE into table
       SELECT user INTO v_username
       FROM dual;
       -- Insert record into audit table
       INSERT INTO orders_audit
       ( order_id,
         quantity_before,
         quantity_after,
         username )
       VALUES
       ( :new.order_id,
         :old.quantity,
         :new.quantity,
         v_username );
    END;Thanks,
    Ajay More
    http://www.moreajays.com

  • Populate table with date

    Hi,
    I a new to forms, using forms10g
    I want to populate a table based on the output of
    select to_number(to_char(last_day(sysdate), 'dd')) from dual;
    if result is 30 then
    30 row in the emp_att table but the att_dt should be from 01-Nov-06 and 30-Nov-06
    create table emp_att ( emp_code varchar2(10), att_dt date);
    How do I achieve this?
    Thanks

    Very nice statement! Thank you.
    Was experimenting with this a little.
    Strange thing that when ran it in sql*plus Oracle9i - it returns only ONE record.
    But, when I run
    create table x as (
    SELECT Trunc(SYSDATE,'MM') + LEVEL - 1 a
    FROM dual
    CONNECT BY LEVEL <= To_Number(To_Char(last_day(SYSDATE),'dd')))
    It inserts correctly 30 records.
    Than I tryed
    SELECT Trunc(SYSDATE,'MM') + x - 1
    FROM (SELECT LEVEL x FROM dual
    CONNECT BY LEVEL <= To_Number(To_Char(last_day(SYSDATE),'dd')))
    returns 30 records.

  • Populate table with Rowset

    Hi all,
    I am currently working on a page that reads an Excel file, eventually I would like it to read other types of files as well, that contains information for the purpose of storing in a database. What I am trying to do is read in the contents of the Excel file and generate a rowset with that information for multiple records and then display those contents on a table of some sort that is populated by that rowset. I've been messing around with cachedrowset a little but I am not sure if that's a step in the right direction. Has anyone else tried this or does anyone know of a better way to accomplish what I am trying?
    Thank you.
    Brian

    Frank,
    Thanks for the reply. What I'm wanting to do is read in a file that contains records that will go into the database, right now I'm focusing on Excel files that can contain one to many (as many as 1000) rows. I've already learned a method to extract the data from each cell and assign it to a variable or textfield, so what I was trying to do is generate a rowset with each row of the Excel file, but not commit it to the database immediately. I would like the rows in the rowset to also fill out some kind of visual component on the page, such as a table, for the user to see the records that they just uploaded and are about to commit to the database. The user can then modify or commit these records to the database.
    As far as my technology preference, I don't really have one, but when I was given the task, rowsets were mentioned so I've been trying to use those.
    Thanks,
    Brian

  • How to Bind a Combo Box so that it retrieves and display content corresponding to the Id in a link table and populates itself with the data in the main table?

    I am developing a desktop application in Wpf using MVVM and Entity Frameworks. I have the following tables:
    1. Party (PartyId, Name)
    2. Case (CaseId, CaseNo)
    3. Petitioner (CaseId, PartyId) ............. Link Table
    I am completely new to .Net and to begin with I download Microsoft's sample application and
    following the pattern I have been successful in creating several tabs. The problem started only when I wanted to implement many-to-many relationship. The sample application has not covered the scenario where there can be a any-to-many relationship. However
    with the help of MSDN forum I came to know about a link table and managed to solve entity framework issues pertaining to many-to-many relationship. Here is the screenshot of my application to show you what I have achieved so far.
    And now the problem I want the forum to address is how to bind a combo box so that it retrieves Party.Name for the corresponding PartyId in the Link Table and also I want to populate it with Party.Name so that
    users can choose one from the dropdown list to add or edit the petitioner.

    Hello Barry,
    Thanks a lot for responding to my query. As I am completely new to .Net and following the pattern of Microsoft's Employee Tracker sample it seems difficult to clearly understand the concept and implement it in a scenario which is different than what is in
    the sample available at the link you supplied.
    To get the idea of the thing here is my code behind of a view vBoxPetitioner:
    <UserControl x:Class="CCIS.View.Case.vBoxPetitioner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:v="clr-namespace:CCIS.View.Case"
    xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
    mc:Ignorable="d"
    d:DesignWidth="300"
    d:DesignHeight="200">
    <UserControl.Resources>
    <DataTemplate DataType="{x:Type vm:vmPetitioner}">
    <v:vPetitioner Margin="0,2,0,0" />
    </DataTemplate>
    </UserControl.Resources>
    <Grid>
    <HeaderedContentControl>
    <HeaderedContentControl.Header>
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
    <TextBlock Margin="2">
    <Hyperlink Command="{Binding Path=AddPetitionerCommand}">Add Petitioner</Hyperlink>
    | <Hyperlink Command="{Binding Path=DeletePetitionerCommand}">Delete</Hyperlink>
    </TextBlock>
    </StackPanel>
    </HeaderedContentControl.Header>
    <ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentPetitioner, Mode=TwoWay}" ItemsSource="{Binding Path=tblParties}" />
    </HeaderedContentControl>
    </Grid>
    </UserControl>
    This part is working fine as it loads another view that is vPetioner perfectly in the manner I want it to be.
    Here is the code of vmPetitioner, a ViewModel:
    Imports Microsoft.VisualBasic
    Imports System.Collections.ObjectModel
    Imports System
    Imports CCIS.Model.Party
    Namespace CCIS.ViewModel.Case
    ''' <summary>
    ''' ViewModel of an individual Email
    ''' </summary>
    Public Class vmPetitioner
    Inherits vmParty
    ''' <summary>
    ''' The Email object backing this ViewModel
    ''' </summary>
    Private petitioner As tblParty
    ''' <summary>
    ''' Initializes a new instance of the EmailViewModel class.
    ''' </summary>
    ''' <param name="detail">The underlying Email this ViewModel is to be based on</param>
    Public Sub New(ByVal detail As tblParty)
    If detail Is Nothing Then
    Throw New ArgumentNullException("detail")
    End If
    Me.petitioner = detail
    End Sub
    ''' <summary>
    ''' Gets the underlying Email this ViewModel is based on
    ''' </summary>
    Public Overrides ReadOnly Property Model() As tblParty
    Get
    Return Me.petitioner
    End Get
    End Property
    ''' <summary>
    ''' Gets or sets the actual email address
    ''' </summary>
    Public Property fldPartyId() As String
    Get
    Return Me.petitioner.fldPartyId
    End Get
    Set(ByVal value As String)
    Me.petitioner.fldPartyId = value
    Me.OnPropertyChanged("fldPartyId")
    End Set
    End Property
    End Class
    End Namespace
    And below is the ViewMode vmParty which vmPetitioner Inherits:
    Imports Microsoft.VisualBasic
    Imports System
    Imports System.Collections.Generic
    Imports CCIS.Model.Case
    Imports CCIS.Model.Party
    Imports CCIS.ViewModel.Helpers
    Namespace CCIS.ViewModel.Case
    ''' <summary>
    ''' Common functionality for ViewModels of an individual ContactDetail
    ''' </summary>
    Public MustInherit Class vmParty
    Inherits ViewModelBase
    ''' <summary>
    ''' Gets the underlying ContactDetail this ViewModel is based on
    ''' </summary>
    Public MustOverride ReadOnly Property Model() As tblParty
    '''' <summary>
    '''' Gets the underlying ContactDetail this ViewModel is based on
    '''' </summary>
    'Public MustOverride ReadOnly Property Model() As tblAdvocate
    ''' <summary>
    ''' Gets or sets the name of this department
    ''' </summary>
    Public Property fldName() As String
    Get
    Return Me.Model.fldName
    End Get
    Set(ByVal value As String)
    Me.Model.fldName = value
    Me.OnPropertyChanged("fldName")
    End Set
    End Property
    ''' <summary>
    ''' Constructs a view model to represent the supplied ContactDetail
    ''' </summary>
    ''' <param name="detail">The detail to build a ViewModel for</param>
    ''' <returns>The constructed ViewModel, null if one can't be built</returns>
    Public Shared Function BuildViewModel(ByVal detail As tblParty) As vmParty
    If detail Is Nothing Then
    Throw New ArgumentNullException("detail")
    End If
    Dim e As tblParty = TryCast(detail, tblParty)
    If e IsNot Nothing Then
    Return New vmPetitioner(e)
    End If
    Return Nothing
    End Function
    End Class
    End Namespace
    And final the code behind of the view vPetitioner:
    <UserControl x:Class="CCIS.View.Case.vPetitioner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
    mc:Ignorable="d"
    Width="300">
    <UserControl.Resources>
    <ResourceDictionary Source=".\CompactFormStyles.xaml" />
    </UserControl.Resources>
    <Grid>
    <Border Style="{StaticResource DetailBorder}">
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <TextBlock Grid.Column="0" Text="Petitioner:" />
    <ComboBox Grid.Column="1" Width="240" SelectedValuePath="." SelectedItem="{Binding Path=tblParty}" ItemsSource="{Binding Path=PetitionerLookup}" DisplayMemberPath="fldName" />
    </Grid>
    </Border>
    </Grid>
    </UserControl>
    The problem, presumably, seems to be is that the binding path "PetitionerLookup" of the ItemSource of the Combo box in the view vPetitioner exists in a different ViewModel vmCase which serves as an ObservableCollection for MainViewModel. Therefore,
    what I need to Know is how to route the binding path if it exists in a different ViewModel?
    Sir, I look forward to your early reply bringing a workable solution to the problem I face. 
    Warm Regards,
    Arun

  • How to populate table rows with selected listbox items?

    Hello,
    I am trying to populate a table with selected listbox items. Each item should be a new row in the table. The picture below is the listbox and table I am using. I need to get the selected name to populate the Attendee column of the table when the user clicks the Add button. How do you do this with mutltiple attendees selected?
    Thank you,
    Angie

    So you're considering the fact the if the user clicks the button twice, the name will appear twice and you don't want this, right?
    Then you must check if any value is the same than the one you are about to add in the row..
    for (var i = 0 ; i < ListBox1.length; i++){
         if (ListBox1.getItemState(i) == true){
              for (var x = 0 ; x < Table1._Row1.count; x++){
                   var boNewAttendee = true;
                   var strAttendee = Table1.resolveNode("Row1[" + x.toString() + "]").txtAttendee;
                   var newAttendee = ListBox1.getDisplayItem(i);
                   if (strAttendee.rawValue == newAttendee){
                        boNewAttendee = false;
                        break;
              if (boNewAttendee){
                   txtAttendee.rawValue = ListBox1.getDisplayItem(i);

  • How to populate a jsf table with an array?

    I have a JSF project where I'm using a table and I would like to populate that table with some custom information without using a database. I'm trying to write my own data provider. I was wondering if anyone knows how to populate a jsf table using an array. Any help would be appreciated. Thanks.

    Hey thanks for replying. I'm not quite sure what you mean, but I am using a woodstock table in Netbeans. I would love to skip writing the data provider since I've never done that before, but I'm not sure how I would go about populating the table with a regular List or Model. I have populated a JTable with my own model, but never a woodstock table. They don't seem to work the same way. Thanks for the help. I've spent hours trying to figure this out.

  • How to populate a table with ORDSYS.ORDImage item by BLOB item?

    Hi, I have a table, that contain blob column and another table with ORDSYS.ORDImage column and I would like to populate ORDSYS.ORDImage item in table by BLOB item, in which I have store some images?

    You should be able to do something like (this is off the top of my head, so please excuse any compile errors...):
    define
    b blob;
    i ordsys.ordimage;
    begin
    INSERT INTO ordsysImgs VALUES (1,ORDSYS.ORDImage.init());
    select imgCol into i from ordsysImgs where ID = 1 for update;
    select blobcol into b from blobImgTable;
    i.source.localdata := b;
    i.setlocal();
    i.setproperties();
    update imgcol set imgCol = i where ID = 1;
    commit;
    end;

  • Trying to populate a table with data from WebRowset

    Hi,
    I want to be able to populate my tables with data from WebRowsets that have been saved to files. Everything goes good until I get to acceptChanges(). At which point I get a NullPointerException.
    Here's the code...
    WebRowSet wrs = new WebRowSetImpl();
    FileReader reader = new FileReader(inputFile);
    wrs.readXml(reader);
    wrs.beforeFirst();
    CachedRowSet crs = new CachedRowSetImpl();
    crs.setSyncProvider("com.sun.rowset.providers.RIXMLProvider");
    crs.populate(wrs);
    crs.beforeFirst();
    crs.acceptChanges(con);
    Results in...
    java.lang.NullPointerException
    at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:867)
    at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:919)
    I'm using Java 1.5_02. I looked at the source code for CachedRowSetImpl, and the only thing I could think of is that maybe "provider.getRowSetWriter()" in the following snippet is returning null....
    public void setSyncProvider(String s)
    throws SQLException
    provider = SyncFactory.getInstance(s);
    rowSetReader = provider.getRowSetReader();
    rowSetWriter = (TransactionalWriter)provider.getRowSetWriter();
    Any ideas?? Thanks!

    I have the same problem after setting com.sun.rowset.providers.RIXMLProvider.
    Looks like a bug to me.
    By the way, why are you creating a new CachedRowSet and populate it with a WebRowset (which extends CachedRowSet)?

  • Populate PK(DBSequence) in three related tables with master detail association

    Hi
    I use jdeveloper 11.1.1.6.0.
    My English isn't very good.
    I have 3 tables with master detail association between them and primary key from table A should populate to tables B and finally C .The primary key is a sequence from data base and I set PK attribute in table A as a DBSequence. (table C is the child of table B  and table B is the child of table A)
    My association is like this: A->B(BAFk1Assoc) and B ->C(CBFk1Assoc)  and also I select Composition Association for these two association. And I select ‘Cascade Update Key Attribute’
    When I insert row in these three related tables, a negative number create but when I COMMIT the PK populate only to table B not to table C and the exception below raises:
    Constraint "C_B_FK1" is violated during post operation "Insert"
    ORA-02291: integrity constraint (HR.C_B_FK1) violated - parent key not found.
    If I only work with tables A and B, there isn't any problem but if I add table C as the child of B, this exception raises.
    Habib

    The question is how you create the row for table C. Do you create it as child from table b (using the VO for B and using the link to C)?
    In this case the framework should populate the PK of the master row B as FK in table C.
    You may need to control the order in which the rows are posted to the DB to avoid this problem. Read Advanced Entity Object Techniques - 11g Release 1 (11.1.1.6.0) to get more info about this.
    However, sometimes it's easier to control the generation and setting if the PK attributes in the model layer, not relating on db triggers where you get the real values only after the commit operation is done in the db. For this you can use a Groovy expression so you have access to the PK of each new created row right after creation. Read Using Groovy Expression to set a Primary Key with a Sequence Number | JDev &amp;amp; ADF Goodies to find out how to do this.
    Timo

  • To populate dynamically created int table with data from other table

    Hi everybody,
    I have already created an internal table dynamically, but now want to populate it with data from another IT depending on the plant name.
    My dynamic int table contains fields with plant name like '8001' ,'8002' and so on.
    no I want to read data from the other table and depending on bwkey which contains similar data like plant name , want to append to this new dynamic int table through read key statement.
    I cannot reference the field name hard coded as it does not allow field symbol reference to be hard coded.
    Pls help.

    Hi,
    Check the code below:
    REPORT  ztestdyn.
    TYPE-POOLS : slis.
    TABLES: yyle0003.
    DATA:
      g_exit    TYPE c,
      g_save    VALUE 'A',               "For parameter I_SAVE
      g_repid   LIKE sy-repid,           "For program name
      g_variant TYPE disvariant.         "For parameter IS_VARIANT
    *Tables
      DATA: d_ref TYPE REF TO data,
            d_ref1 TYPE REF TO data,
            i_alv_cat1 TYPE TABLE OF lvc_s_fcat,
            ls_alv_cat1 LIKE LINE OF i_alv_cat1.
      DATA: BEGIN OF total_tab OCCURS 0 ,
            tknum TYPE yyle0003-tknum,
            quantity TYPE p,  "yyle0003-QUANTITY,
            END OF total_tab.
      DATA: BEGIN OF g_scandata_tab OCCURS 0.
              INCLUDE STRUCTURE yyle0003.
      DATA: END OF g_scandata_tab.
      DATA: g_yyle0003_tab LIKE yyle0003 OCCURS 0 WITH HEADER LINE.
      DATA: g_itab1 TYPE TABLE OF yyle0003.
      DATA: wa_itab1 LIKE g_scandata_tab.
      TYPES: BEGIN OF itab2,
             tknum TYPE yyle0003-tknum,
             vhilm TYPE yyle0003-vhilm,
             quantity TYPE p,
             END OF itab2.
      DATA: g_itab3 TYPE TABLE OF itab2.
      DATA: wa_itab3 TYPE itab2.
      DATA: g_itab5 TYPE TABLE OF itab2.
      DATA: wa_itab5 TYPE itab2.
      DATA: g_itab4 TYPE TABLE OF itab2.
      DATA: wa_itab4 TYPE itab2.
      DATA: gv_wa TYPE REF TO data.
      DATA : wa_tab TYPE itab2.
      DATA: BEGIN OF itab6 OCCURS 0,
             vhilm TYPE yyle0003-vhilm,
             quantity TYPE p,
             END OF itab6.
    ******************Start of Internal Table Definition *******************
      DATA:
            g_custom_container_0100 TYPE REF TO cl_gui_custom_container,
            g_alv_grid_0100    TYPE REF TO cl_gui_alv_grid,
            g_container_0100   TYPE scrfname VALUE 'LIST',
            g_mylayout         TYPE lvc_s_layo,
            ok_code            LIKE sy-ucomm.
      FIELD-SYMBOLS :<f_fs> TYPE table,
                     <f_fs11> TYPE table,
                     <f_fs1> TYPE table,
                     <f_fs3> TYPE ANY,
                     <f_fs4> TYPE ANY,
                     <f_field> TYPE ANY,
                     <f_fs5> TYPE ANY.
      FIELD-SYMBOLS: <fs_wa> TYPE ANY.
      DATA: l_var TYPE i,
            l_i   TYPE i.
      DATA: l_var1 TYPE char20,
            l_var2 TYPE char20.
    DATA: l_TOTAL TYPE I,
          L_FILL TYPE i,
          L_TOT  TYPE I.
    DATA: l_int TYPE i,
           l_sum TYPE i.
    FIELD-SYMBOLS: <f_fs2> TYPE  itab2, "
                     <f_fs6> TYPE ANY,
                     <f_fs7> TYPE ANY.
      DATA: l_var3 TYPE char15.
      DATA: l_quant TYPE p.
    FIELD-SYMBOLS: <f_fs8> LIKE itab6, "
                     <f_fs9> TYPE ANY,
                     <f_fs10> TYPE ANY.
    FIELD-SYMBOLS : <f_fs12> TYPE ANY,
                      <f_fs13> TYPE ANY.
      SORT g_scandata_tab BY tknum vhilm.
      LOOP AT g_scandata_tab INTO wa_itab1.
        MOVE-CORRESPONDING wa_itab1 TO wa_itab3.
        APPEND wa_itab3 TO g_itab3.
      ENDLOOP.
      LOOP AT g_itab3 INTO wa_itab3.
        COLLECT wa_itab3 INTO g_itab4.
      ENDLOOP.
      LOOP AT g_itab4 INTO wa_itab4.
        MOVE-CORRESPONDING wa_itab4 TO wa_itab5.
        MOVE-CORRESPONDING wa_itab4 TO itab6.
        APPEND wa_itab5 TO g_itab5.
        COLLECT itab6.
      ENDLOOP.
      CLEAR wa_itab3.
      SORT g_itab4 BY tknum vhilm.
      DELETE ADJACENT DUPLICATES FROM g_itab4 COMPARING vhilm.
      DESCRIBE TABLE g_itab4 LINES l_var.
      l_i = '2'.
      ls_alv_cat1-fieldname = 'TKNUM'.
      ls_alv_cat1-col_pos = 1.
      ls_alv_cat1-coltext ='ShipmentNo.'.
      APPEND ls_alv_cat1 TO i_alv_cat1.
      DATA: l_var4(10) TYPE c,
            l_var5(10) TYPE c,
            l_fieldname(20) TYPE c..
      LOOP AT g_itab4 INTO wa_itab4.
        IF l_var >= 1.
          CONDENSE wa_itab4-vhilm NO-GAPS.
          ls_alv_cat1-fieldname = wa_itab4-vhilm. "l_fieldname.
          ls_alv_cat1-col_pos = l_i.
          ls_alv_cat1-coltext = wa_itab4-vhilm.
          ls_alv_cat1-do_sum  ='X'.
          APPEND ls_alv_cat1 TO i_alv_cat1.
          CLEAR : ls_alv_cat1, l_fieldname.
          l_i = l_i + 1.
        ENDIF.
        AT LAST.
          ls_alv_cat1-fieldname = 'TOTAL'. "l_fieldname.
          ls_alv_cat1-col_pos = l_i.
          ls_alv_cat1-coltext = 'TOTAL'.
          ls_alv_cat1-do_sum  ='X'.
          APPEND ls_alv_cat1 TO i_alv_cat1.
          CLEAR : ls_alv_cat1, l_fieldname.
        ENDAT.
        SORT i_alv_cat1 BY fieldname.
        DELETE ADJACENT DUPLICATES FROM i_alv_cat1.
      ENDLOOP.
      SORT i_alv_cat1 BY col_pos.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = i_alv_cat1
        IMPORTING
          ep_table = d_ref.
      ASSIGN d_ref->* TO <f_fs>.
      CREATE DATA gv_wa LIKE LINE OF <f_fs>.
      ASSIGN gv_wa->* TO <fs_wa>.
      DELETE ADJACENT DUPLICATES FROM <f_fs> COMPARING ALL FIELDS.
        LOOP AT itab6.
        CLEAR wa_itab5.
        wa_itab5-tknum = 'Total'.
        MOVE-CORRESPONDING itab6 TO wa_itab5.
        APPEND wa_itab5 TO g_itab5.
        CLEAR wa_itab5.
      ENDLOOP.
         DESCRIBE TABLE g_itab5 LINES L_TOT.
           LOOP AT TOTAL_TAB.
          L_TOTAL = L_TOTAL + total_tab-quantity.
         ENDLOOP.
      LOOP AT g_final ASSIGNING <f_fs2>.
        ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <f_fs2> TO <f_fs6>.
        ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <fs_wa> TO <f_fs7>.
        <f_fs7> = <f_fs6>.
        CONDENSE <f_fs2>-vhilm NO-GAPS.
        ASSIGN COMPONENT 'VHILM' OF STRUCTURE <f_fs2> TO <f_fs3>.
        ASSIGN COMPONENT 3 OF STRUCTURE <f_fs2> TO <f_fs4>.
        MOVE <f_fs3> TO l_var1.
        ASSIGN COMPONENT l_var1 OF STRUCTURE <fs_wa> TO <f_fs5>.
        <f_fs5> =  <f_fs4>.
        CLEAR total_tab-quantity.
        READ TABLE total_tab WITH KEY tknum = <f_fs6>.
        IF sy-subrc = 0.
          ASSIGN total_tab-quantity TO <f_fs12>.
          ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <fs_wa> TO <f_fs13>.
          <f_fs13> = <f_fs12>.
        ENDIF.
        L_FILL = L_FILL + 1.
        IF L_FILL = L_TOT.
         ASSIGN L_TOTAL TO <f_fs12>.
          ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <fs_wa> TO <f_fs13>.
          <f_fs13> = <f_fs12>.
        ENDIF.
        AT END OF <f_fs2>-tknum.
          APPEND <fs_wa> TO <f_fs>.
          CLEAR  <fs_wa>.
        ENDAT.
      ENDLOOP.
      CLEAR: <f_fs6>,
              <f_fs7>.
      CLEAR <fs_wa>.
    CALL SCREEN 0100.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZVKS'.
      SET TITLEBAR 'ZVKS'.
      CHECK sy-ucomm IS INITIAL.
      SORT g_scandata_tab BY tknum vhilm.
      CREATE OBJECT g_custom_container_0100
             EXPORTING container_name = g_container_0100
             EXCEPTIONS
               cntl_error = 1
               cntl_system_error = 2
               create_error = 3
               lifetime_error = 4
               lifetime_dynpro_dynpro_link = 5.
      CREATE OBJECT g_alv_grid_0100
             EXPORTING i_parent = g_custom_container_0100.
      g_mylayout-grid_title = 'Display Scanning data'.
      CALL METHOD g_alv_grid_0100->set_table_for_first_display
        CHANGING
          it_outtab                     = <f_fs>
          it_fieldcatalog               = i_alv_cat1
                    EXCEPTIONS
                      invalid_parameter_combination = 1
                      program_error                 = 2
                      too_many_lines                = 3
                      OTHERS                        = 4.
      IF sy-subrc <> 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    Regards
    Kannaiah

  • Populate target table with default value

    I have a query like this:
    SELECT 0 AS ID,
    9999999999 AS CODE
    FROM DUAL
    UNION ALL
    SELECT VEH.TP_ID AS ID,
    VEH.VEH_ID AS CODE
    FROM TB_VEHICLE;
    So I have an interface with two data sets, one for each query.
    The first data set represents the "select from dual" "constant values" and the second represents the "select * from tb_vehicle".
    In the first data set I don´t have a source, then ODI generates a select without a table "select 0 AS ID, 99999 AS CODE FROM".
    Any ideas on how can I achieve my objective? I need to populate one row on target table with constant values.
    Thanks

    Alternatively , try this :
    Duplicate the LKM and IKM you are using, create copies , something like LKM xyz (No Source) , IKM xyz (No Source).
    Then adust the KM steps accordingly, remove the 'FROM' part and replace with VALUES ( ) , keeping the odiref substitution call in the parenthesis.
    So you basically have a knowlede module that accepts no source data, generating :
    insert into C$
    (col 1, col 2, col 3 etc)
    VALUES
    (Target mapping 1, target mapping 2, target mapping 3 etc)
    I've seen it done, nice and tidy, keeps all the lineage in ODI etc.

  • Populate SQL table with data from Oracle DB in ODI

    Hi,
    I am trying to populate a source SQL table with fields from an Oracle db in ODI. I am trying to perform this using a procedure and I am am getting the following error:
    ODI-1226: Step PROC_1_Contract_Sls_Person_Lookup fails after 1 attempt(s).
    ODI-1232: Procedure PROC_1_Contract_Sls_Person_Lookup execution fails.
    ODI-1228: Task PROC_1_Contract_Sls_Person_Lookup (Procedure) fails on the target MICROSOFT_SQL_SERVER connection Phys_HypCMSDatamart.
    Caused By: weblogic.jdbc.sqlserverbase.ddc: [FMWGEN][SQLServer JDBC Driver][SQLServer]Invalid object name 'C2C_APP.CON_V'.
    My question is what is the best method to populate SQL db with data from an Oracle db? Using a procedure? A specific LKM?
    I found threads referring to using an LKM to populate Oracle tables with data from a SQL table....but nothing for the opposite.
    Any information would help.
    thanks,
    Eric

    Hi Eric,
    If using an Interface, I would recommend the LKM SQL to MSSQL (BULK) knowledge module. This will unload the data from Oracle into a file, then bulk load the staging db on the target using a BULK INSERT.
    Regards,
    Michael Rainey

  • Web Analysis : populate the same table with multiple data sources

    Hi folks,
    I would like to know if it is possible to populate a table with multiple data sources.
    For instance, I'd like to create a table with 3 columns : Entity, Customer and AvgCostPerCust.
    Entity and Customer come from one Essbase, AvgCostPerCust comes from HFM.
    The objective is to get a calculated member which is Customer * AvgCostPerCust.
    Any ideas ?
    Once again, thanks for your help.

    I would like to have the following output:
    File 1 - Store 2 - Query A + Store 2 - Query B
    File 2 - Store 4 - Query A + Store 4 - Query B
    File 3 - Store 5 - Query A + Store 5 - Query B
    the bursting level should be give at
    File 1 - Store 2 - Query A + Store 2 - Query B
    so the tag in the xml has to be split by common to these three rows.
    since the data is coming from the diff query, and the data is not going to be under single tag.
    you cannot burst it using concatenated data source.
    But you can do it, using the datatemplate, and link the query and get the data for each file under a single query,
    select distinct store_name from all-stores
    select * from query1 where store name = :store_name === 1st query
    select * from query2 where store name = :store_name === 2nd query
    define the datastructure the way you wanted,
    the xml will contain something like this
    <stores>
    <store> </store> - for store 2
    <store> </store> - for store 3
    <store> </store> - for store 4
    <store> </store> - for store 5
    <stores>
    now you can burst it at store level.

Maybe you are looking for