Search code examples
recordpeoplesoftrowsetpeoplesoft-app-engine

Filling 2 records inside of a rowset


I am trying to find out how to fill two seperate records in one rowset to be published to integration broker. I am filling both rowsets seperatly (RS1 for the Level 1 of record Names and RS for the Level 0 record of Person)

&RS1 = CreateRowset(Record.NAMES); 
&RS1.Fill("Where emplid=:1 and name_type=:2", &emplid, &nameType); 

&RS = CreateRowset(Record.PERSON, &RS1); 
&RS.Fill("Where emplid=:1", &emplid);

I have also tried to use this after the above code and the NAMES record didnt show up into the rowset

&RS1.CopyTo(&RS, Record.NAMES, Record.PERSON);

The problem is that when I look at &RS after this runs, the Names record in &RS does not contain any of the name information from &RS1, but the person record is populated. Could anybody help me on how to get this name record in &RS populated with the data from &RS1?


Solution

  • The issue with your code is that &RS1 is really just used to determine the structure of &RS. The actual instantiated rowset is not part of &RS. In the code below note where I get the NAMES rowset for a specific row and assign it to &RS1, then I fill it.

    Local Rowset &RS, &RS1;
    
    &RS1 = CreateRowset(Record.NAMES);
    &RS = CreateRowset(Record.PERSON, &RS1);
    
    &RS.Fill("Where emplid=:1", &emplid);
    &RS1 = &RS(1).GetRowset(Scroll.NAMES);
    &RS1.Fill("Where emplid=:1 and name_type=:2", &emplid, &nameType);