Search code examples
recordpeoplesoftrowsetpeoplesoft-app-engine

Peoplesoft CreateRowset with related display record


According to the Peoplebook here, CreateRowset function has the parameters {FIELD.fieldname, RECORD.recname} which is used to specify the related display record.

I had tried to use it like the following (just for example):

&rs1 = CreateRowset(Record.User, Field.UserId, Record.UserName);
&rs1.Fill();

For &k = 1 To &rs1.ActiveRowCount
MessageBox(0, "", 999999, 99999, &rs1(&k).UserName.Name.Value);
End-for;

(Record.User contains only UserId(key), Password.
Record.UserName contains UserId(key), Name.)

I cannot get the Value of UserName.Name, do I misunderstand the usage of this parameter?


Solution

  • Fill is the problem. From the doco:

    Note: Fill reads only the primary database record. It does not read any related records, nor any subordinate rowset records.

    Having said that, it is the only way I know to bulk-populate a standalone rowset from the database, so I can't easily see a use for the field in the rowset.

    Simplest solution is just to create a view, but that gets old very soon if you have to do it a lot. Alternative is to just loop through the rowset yourself loading the related fields. Something like:

    For &k = 1 To &rs1.ActiveRowCount
      &rs1(&k).UserName.UserId.value = &rs1(&k).User.UserId.value;
      &rs1(&k).UserName.SelectByKey();
    End-for;