Monday, December 5, 2016

Peoplesoft Dynamic Dropdown list with extra dropdown values

I am working in an organization which is using CMS of oracle called peoplesoft. In that CMS there was a requirement. The requirement is like this. So we have all these school names in our database and there a a table dedicated to the names of the Schools. I wanted to populate a dropdown menu which will show the names of the schools plus some other values in the dropdown too. Also I shouldn't insert a row in the table. Although this is a simple mechanism in html and css, in peoplesoft it requires a bit of programming. So first I made a field 30 characters long. It can be any amount of characters you want. Then I added a prompt table to the field ACAD_GROUP_TBL. with this prompt table added I got all the names of the schools in my field. Now comes the tricky part. Why is it tricky, well because there are two methods to achieve this feat. First one is crude, you make a new table and add the row you want to display in your dropdown values. Why is this crude, well you have to add a table thats why and I don't want to mess with the tables as much as possible today i add a table for this tomorrow i add more tables and keep on doing this and eventually the database is huge with repetitive tables with minor changes. So the work around is this. Add the code below to the rowinit of the field which you added the prompt table to.

Local Rowset &Xlat;

&FLD = GetRecord(Record.RR_REG_CON_SCH2).GetField(Field.RR_REG_REMARKS);
&FLD.ClearDropDownList();


&Xlat = CreateRowset(Record.ACAD_GROUP_TBL);
&Xlat.Fill();

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

&FLD.AddDropDownItem("code", "description");

Once is this done you got yourself a dynamic drop down list which populates first from the ACAD_GROUP_TBL then adds somemore.


 

No comments:

Post a Comment