How to Clear Drop-Down List PeopleCode
How to Clear Drop-Down List PeopleCode: Dynamic DropDown Lists PeopleCode for sort or clear some dropdown list by PeopleCode for each requirement. You can clear drop-down list of translate values in PeopleCode at rowinit event or field change event.
This peoplecode for clear all translate values of field “WO_WO_TYPE” and select some data for show in drop-down list box by use code where expression and order by this code
“Where fieldname = ‘WO_WO_TYPE’ AND FIELDVALUE NOT IN ( ‘0’,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,’10’,’12′” ORDER BY decode(XLATLONGNAME,’Income’,0,’Value Creation’,’2′ ,’Benchmarking’,’3′ ,’Risk Management’,3 ,’KPI Main’,3,1)
Peoplecode Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Local Rowset &Xlat; &Xlat = CreateRowset(Record.PSXLATITEMLANG); &Xlat.Flush(); rem &Xlat.Fill("Where fieldname = 'Field Name' order by decode(Fieldvalue,'Jan',1,0),fieldvalue"); &Xlat.Fill("Where fieldname = 'WO_WO_TYPE' AND FIELDVALUE NOT IN ( '0','1','2','3','4','5','6','7','8','9','10','12') ORDER BY decode(XLATLONGNAME,'Income',0,'Value Creation','2' ,'Benchmarking','3' ,'Risk Management',3 ,'KPI Main',3,1)"); WO_TBL.WO_WO_TYPE.ClearDropDownList(); &j = &Xlat.ActiveRowCount + 1; For &i = 1 To &Xlat.ActiveRowCount &Value = &Xlat.GetRow(&i).PSXLATITEMLANG.FIELDVALUE.Value; &descr = &Xlat.GetRow(&i).PSXLATITEMLANG.XLATLONGNAME.Value; rem DERIVED_WO.WO_WO_TYPE.AddDropDownItem(&Value, &Descr); If &Value = "11" Then &descr = "Value Creation Special"; End-If; WO_TBL.WO_WO_TYPE.AddDropDownItem(&Value, Rept(Char(9), &j - &i) | &descr); End-For; |
For Example
This PeopleCode for replacing in Rowint in Record field
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Local Rowset &Xlat; &Xlat = CreateRowset(Record.TS_RANGESCORED); &Xlat.Flush(); rem &Xlat.Fill("Where fieldname = 'Field Name' order by decode(Fieldvalue,'Jan',1,0),fieldvalue"); &Xlat.Fill(" ORDER BY TS_RANGE_SCORE_D desc "); TS_PERF_TRAN.TS_RANGE_SCORE_D.ClearDropDownList(); &j = &Xlat.ActiveRowCount + 1; For &i = 1 To &Xlat.ActiveRowCount &Value = &Xlat.GetRow(&i).TS_RANGESCORED.TS_RANGE_SCORE_D.Value; &descr = &Xlat.GetRow(&i).TS_RANGESCORED.DESCR100.Value; TS_PERF_TRAN.TS_RANGE_SCORE_D.AddDropDownItem(&Value, Rept(Char(9), &j - &i) | &descr); End-For; |
Example code of dropdown list in row init event of record
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
If %Page = Page.TEST_PERF_TRAN Then /*--- Define Year_Tha & Quater from TEST_perf_sch ----*/ SQLExec("select to_number(to_char(EFFDT,'yyyy'))+543, decode (to_char(EFFDT,'mm') ,06,1,11,2) from ps_TEST_perf_srch where TEST_EMPLID_TO_NUM =:1 and EMPLID=:2 and EFFDT =%datein(:3)", TEST_PERF_SRCH.TEST_EMPLID_TO_NUM, TEST_PERF_SRCH.EMPLID, TEST_PERF_SRCH.EFFDT, &YEAR_THA, &QUATER); Local Rowset &Xlat; &Xlat = CreateRowset(Record.TEST_PERFDISPTBL); &Xlat.Flush(); rem &Xlat.Fill("Where fieldname = 'Field Name' order by decode(Fieldvalue,'Jan',1,0),fieldvalue"); &Xlat.Fill(" WHERE TEST_YEAR_THA = :1 and TEST_quater = :2 and TEST_WO_WO1_TYPE = :3 ORDER BY to_number(TEST_PERF_DISP) desc ", &YEAR_THA, &QUATER, TEST_PERF_TRAN.TEST_WO_WO1_TYPE); TEST_PERF_TRAN.TEST_PERF_DISP_D.ClearDropDownList(); rem WinMessage(&Xlat.ActiveRowCount, 0); For &i = 1 To &Xlat.ActiveRowCount &Value = &Xlat.GetRow(&i).TEST_PERFDISPTBL.TEST_PERF_DISP.Value; &descr = &Xlat.GetRow(&i).TEST_PERFDISPTBL.DESCR100.Value; rem WinMessage(&Value, 0); TEST_PERF_TRAN.TEST_PERF_DISP_D.AddDropDownItem(&Value, Rept(Char(9), &j - &i) | &descr); End-For; End-If; |