Showing posts with label PeopleCode. Show all posts
Showing posts with label PeopleCode. Show all posts

Tuesday, December 13, 2011

has been updated by another user (3,1)

Whenever we have error with description: 'has been updated by another user (3,1)' in Application Designer, Purge Cache Directories in Configuration Manager will help. This is expected when we edit PeopleCode on Component level.

Some times it is not same as deleting files in directory: PS/CACHE. As such, first option is suggested over Second one.


Wednesday, August 4, 2010

Dynamic Dropdown Values

&FLD = GetRecord(Record.HM_EMP_BEN_PLAN).GetField(Field.HM_BEN_PLAN_TYPE);
&FLD.ClearDropDownList();
&Xlat = CreateRowset(Record.PSXLATITEM);
&Xlat.Fill("WHERE FILL.FIELDNAME = 'HM_BEN_PLAN_TYPE' AND FILL.FIELDVALUE IN ('10','01') AND FILL.EFFDT = (SELECT MAX(EFFDT) FROM PSXLATITEM B WHERE B.FIELDNAME = 'HM_BEN_PLAN_TYPE' AND B.FIELDVALUE = FILL.FIELDVALUE AND EFFDT <= SYSDATE)");
&Xlat_cnt = &Xlat.ActiveRowCount;

For &I = 1 To &Xlat_cnt
&CodeIn = &Xlat.GetRow(&I).GetRecord(1).FIELDVALUE.Value;
&DescIn = &Xlat.GetRow(&I).GetRecord(1).XLATLONGNAME.Value;
&FLD.AddDropDownItem(&CodeIn, &DescIn);
End-For;

Syntax for Some Object Oriented Programming Language in PeopleSoft

&record.field.Enabled = False is equivalent to UnGray(RecordName.FieldName)
&record.field.Enabled = True is equivalent to Gray(RecordName.FieldName)

in Gray() and UnGray() functions we can not use Variable in place of record name.
Example:
case 1: This will not work
&RECORD = &LEVEL2_ROW.HM_EMP_BEN_D_VW;
Gray(&RECORD.HM_INCURRED_BY);

Case 2: This will work
&RECORD = &LEVEL2_ROW.HM_EMP_BEN_D_VW;
&RECORD.HM_INCURRED_BY.enabled = False;
This is very useful in Row Traversing where we can not use RecordName.FieldName.

Some more OOPS Syntax in PS:
&record.field.IsChanged;

Thursday, July 22, 2010

Can we use same record on level zero and level 1 as primary record?

Question: Can we use same record on level zero and level 1 and on both levels it is being used as primary record?
Answer is Yes. Hold on.... We have a condition here.

If we have effective date as one of the keys and all the fields after Effective date are being used in Level 1 then we can use same record on level zero and level 1 and on both levels it is can be used as primary record.

Otherwise, with other keys, it will not serve any purpose, though it is technically feasible.

Monday, May 24, 2010

Row Traversing

&LEVEL0 = GetLevel0();                                               --level zero rowset
&LEVEL0_ROW = &LEVEL0(1);                                            --Level Zero Row
&LEVEL1 = &LEVEL0_ROW.GetRowset(SCROLL.EMPL_CHECKLIST);              --level1 Rowset


For &I = 1 to &LEVEL1.ActiveRowCount --for loop to get all the values till current row
   &LEVEL1_ROW = &LEVEL1(&I);
   &LEVEL2 = &LEVEL1_ROW.GetRowset(SCROLL.EMPL_CHKLST_ITM);
   For &J = 1 to &LEVEL2.ActiveRowCount
        &LEVEL2_ROW = &LEVEL2(&J);
        &LEVEL3 = &LEVEL2_ROW.GetRowset(SCROLL.EMPL_CHKLST_ITM_1);
        For &k = 1 to &LEVEL3.ActiveRowCount
                &LEVEL3_ROW = &LEVEL3(&k);
               &RECORD = &LEVEL3_ROW.EMPL_CHKLST_ITM_1;              --get record
               &Emplid = &RECORD.emplid.value;                       --get value
               Winmessage(“Employee ID: “|&Emplid);                  --to display all retrieved employee IDs online
        End-For;
   End-For;
End-For;

In this case for suppose we have 1 row in EMPL_CHECKLIST, 5 rows in EMPL_CHKLST_ITM, 10 rows in EMPL_CHKLST_ITM_1 for the same employee ID, then we will get 10 messages when the system executes given code.


Some more Row Traversing functions:

CurrentRowNumber(1);