Question

I have a page that contains a parent record and several children records. There is a field (level 1) that is a checkbox that is a "final draft" field - after this is checked no more changes can be made (even in correction mode); a new row/effdt must be inserted. The children records are all in level 2. Right now, what I have is:

&RS7 = GetRowset(Scroll.AVZ_JD_DTL_TBL);
&final_draft = &RS7.GetRow(1).getrecord(Record.AVZ_JD_DTL_TBL).getfield     (Field.FINAL_VALUE).Value;

If &final_draft = "Y" Then
  Page.AVZ_JD_DTL_PG.DisplayOnly = True;
 Else
  Page.AVZ_JD_DTL_PG.DisplayOnly = False;
 End-If;

So let's say i'm in correction mode, and I have 3 rows - effdts 1/1/2012, 5/1/2012, and 6/1/2012, with the checkbox checked for the row dated 5/1/2012, as I am "paging"/"scrolling' throught the effective dates, I want the row dated 1/1/2012 to be editable, the row dated 5/1/2012 read-only and then the row dated 6/1/2012 to be editable.

I think maybe I will need to "disable" each rowset individually, rather than the page as a whole. I'm just getting my head around rowsets/scrolls, and earlier in the program I am doing some manipulation:

&RS1 = GetLevel0().GetRow(1).GetRowset(Scroll.AVZ_JD_DTL_TBL).GetRow(1).GetRowset(Scroll.AVZ_JD_RESP_TBL); &RS2 = GetLevel0().GetRow(1).GetRowset(Scroll.AVZ_JD_DTL_TBL).GetRow(1).GetRowset(Scroll.AVZ_JD_EXPR_TBL);

&RS1.Sort(AVZ_JD_RESP_TBL.ORDER_SEQ, "A"); &RS2.Sort(AVZ_JD_EXPR_TBL.ORDER_SEQ, "A");

The question is, how do I know which row that I am currently viewing, then grab the FINAL_VALUE field for that row, and then, grey/disable everything on the page for that effdt? (then of course, if you go past that effdt to one that does not have that checkbox ticked, everything will need to be editable again).

Thanks

Was it helpful?

Solution

You could loop through the level 1 scolls looking for the checkbox, then if found loop through the level 2 scrolls and then set the Active attribute for the row to false.

I don't have a PeopleSoft system available to test this code, but it would be something like this:

&LEVEL0 = your level 0 record
&LEVEL1 = &LEVEL0.GetRowset(Scroll.AVZ_JD_DTL_TBL); /* handle to level 1 */
For &I = 1 To &LEVEL1.ActiveRowCount
    if &LEVEL1(&I).final_draft = "Y" then   /* check box is on */
        &LEVEL2 = &LEVEL0(1).&LEVEL1(&I).GetRowset(Scroll.AVZ_JD_EXPR_TBL);
        For &J = 1 to &LEVEL2.ActiveRowCount
            &LEVEL0(1).&LEVEL1(&I).&LEVEL2(&J).AVZ_JD_EXPR_TBL.Active = "False";
        End-For;
    End-If;
End-For;

Assuming your level 1 record is AVZ_JD_DTL_TBL and your level 2 is AVZ_JD_EXPR_TBL. Please double-check PeopleBooks for the exact syntax but I think that is correct.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top