Reply from Paul Haninger on Dec 27 at 2:44 PM Are you getting any error message when the CI is executed? Have you stepped through it with the people code debugger? Most often when I have problems like this it's either a problem with the CI definition or I'm not using the right collections at each level. Using the debugger will help you with that. Paul
| | | ---------------Original Message--------------- From: prasanth Sent: Tuesday, December 27, 2011 5:01 AM Subject: Poplulating data through component interface The data in Levels 0,1,2 is being popluated without any issues,but the level 3 data is not being popluated. Here's the code which i used. /* ===> This is a dynamically generated PeopleCode template to be used only as a helper to the application developer. You need to replace all references to ' ' OR default values with references to PeopleCode variables and/or a Rec.Fields. */ Local File &fileLog; Local ApiObject &oSession, &oLvl4CmptIntfc; Local ApiObject &oCi2Collection, &oCi2; Local ApiObject &oCi3Collection, &oCi3; Local ApiObject &oCiTmp4Collection, &oCiTmp4; Function errorHandler() Local ApiObject &oPSMessageCollection, &oPSMessage; Local number &i; Local string &sErrMsgSetNum, &sErrMsgNum, &sErrMsgText, &sErrType; &oPSMessageCollection = &oSession.PSMessages; For &i = 1 To &oPSMessageCollection.Count &oPSMessage = &oPSMessageCollection.Item(&i); &sErrMsgSetNum = &oPSMessage.MessageSetNumber; &sErrMsgNum = &oPSMessage.MessageNumber; &sErrMsgText = &oPSMessage.Text; &fileLog.WriteLine(&sErrType | " (" | &sErrMsgSetNum | "," | &sErrMsgNum | ") - " | &sErrMsgText); End-For; rem ***** Delete the Messages from the collection *****; &oPSMessageCollection.DeleteAll(); End-Function; try rem ***** Set the Log File *****; &fileLog = GetFile("C:\temp\LVL4_CMPT_INTFC.log", "w", "a", %FilePath_Absolute); &fileLog.WriteLine("Begin"); rem ***** Get current PeopleSoft Session *****; &oSession = %Session; rem ***** Set the PeopleSoft Session Error Message Mode *****; rem ***** 0 - None *****; rem ***** 1 - PSMessage Collection only (default) *****; rem ***** 2 - Message Box only *****; rem ***** 3 - Both collection and message box *****; &oSession.PSMessagesMode = 1; rem ***** Get the Component Interface *****; &oLvl4CmptIntfc = &oSession.GetCompIntfc(CompIntfc.LVL4_CMPT_INTF C); If &oLvl4CmptIntfc = Null Then errorHandler(); throw CreateException(0, 0, "GetCompIntfc failed"); End-If; &SQLTEST = "SELECT A.DEPTID, A.DEPTNAME, A.LOCATION FROM PS_CI_TMP A"; &SQLTEST1 = CreateSQL(&SQLTEST); While &SQLTEST1.Fetch(&DEPTID, &DEPTNAME, &LOCATION) rem ***** Set the Component Interface Mode *****; &oLvl4CmptIntfc.InteractiveMode = True; &oLvl4CmptIntfc.GetHistoryItems = True; &oLvl4CmptIntfc.EditHistoryItems = True; rem ***** Set Component Interface Get/Create Keys *****; &oLvl4CmptIntfc.DEPTID = &DEPTID; REM &oLvl4CmptIntfc.CLASSID = &CLASSID; rem ***** Execute Create ******; If Not &oLvl4CmptIntfc.Get() Then; If Not &oLvl4CmptIntfc.Create() Then; rem ***** Unable to Create Component Interface for the Add keys provided. *****; errorHandler(); throw CreateException(0, 0, "Create failed"); End-If; End-If; rem ***** Begin: Get/Set Component Interface Properties *****; rem ***** Get/Set Level 0 Field Properties *****; &fileLog.WriteLine("&oLvl4CmptIntfc.DE PTID = " | &oLvl4CmptIntfc.DEPTID); &oLvl4CmptIntfc.DEPTID = &DEPTID; &fileLog.WriteLine("&oLvl4CmptIntfc.DE PTNAME = " | &oLvl4CmptIntfc.DEPTNAME); &oLvl4CmptIntfc.DEPTNAME = &DEPTNAME; &fileLog.WriteLine("&oLvl4CmptIntfc.LO CATION = " | &oLvl4CmptIntfc.LOCATION); &oLvl4CmptIntfc.LOCATION = &LOCATION; rem ***** Set/Get CI_2 Collection Field Properties -- Parent: PS_ROOT Collection *****; &oCi2Collection = &oLvl4CmptIntfc.CI_2; Local integer &i19; For &i19 = 1 To &oCi2Collection.Count; &SQLTEST2 = "SELECT B.DEPTID,B.EMPLID,B.NAME FROM PS_CI_TMP2 B"; &SQLTEST3 = CreateSQL(&SQLTEST2); While &SQLTEST3.Fetch(&DEPT1, &EMPLID, &NAME) If &DEPT1 = &DEPTID Then; If &i19 = 1 Then; &oCi2 = &oCi2Collection.Item(1); &oCi2 = &oCi2Collection.InsertItem(&i19); End-If; &fileLog.WriteLine("&oCi2.EMPLID = " | &oCi2.EMPLID); &oCi2.EMPLID = &EMPLID; &fileLog.WriteLine("&oCi2.NAME = " | &oCi2.NAME); &oCi2.NAME = &NAME; End-If; End-While; End-For; rem ***** Set CI_3 Collection Field Properties -- Parent: CI_2 Collection *****; &oCi3Collection = &oCi2.CI_3; Local integer &i212; For &i212 = 1 To &oCi3Collection.Count; &SQLTEST4 = "SELECT C.DEPTID,C.EMPLID,C.DEPENDENT_ID FROM PS_CI_TMP3 C"; &SQLTEST5 = CreateSQL(&SQLTEST4); While &SQLTEST5.Fetch(&DEPT2, &EMPLID1, &DEPENDENT_ID) If &DEPT2 = &DEPTID Then; If &i212 = 1 Then; &oCi3 = &oCi3Collection.Item(1); &oCi3 = &oCi3Collection.InsertItem(&i212); End-If; &fileLog.WriteLine("&oCi3.DEPENDENT_ID = " | &oCi3.DEPENDENT_ID); &oCi3.DEPENDENT_ID = &DEPENDENT_ID; End-If; End-While; End-For; rem ***** Set CI_TMP4 Collection Field Properties -- Parent: CI_3 Collection *****; &oCiTmp4Collection = &oCi3.CI_TMP4; Local integer &i314; For &i314 = 1 To &oCiTmp4Collection.Count; &fileLog.WriteLine("OUTSIDE = "); &SQLTEST6 = "SELECT D.DEPTID,D.EMPLID,D.DEPENDENT_ID,D.CLASSID,D.INSTI TUTION FROM PS_CI_TMP4 D"; &SQLTEST7 = CreateSQL(&SQLTEST6); While &SQLTEST7.Fetch(&DEPT3, &EMPLID3, &DEPENDENT_ID3, &CLASSID, &INSTITUTION) &fileLog.WriteLine("INSIDE"); If &EMPLID3 = &EMPLID Then; If &i314 = 1 Then; &oCiTmp4 = &oCiTmp4Collection.Item(1); &oCiTmp4 = &oCiTmp4Collection.InsertItem(&i314); End-If; &fileLog.WriteLine("&oCiTmp4.CLASSID = " | &oCiTmp4.CLASSID); &oCiTmp4.CLASSID = &CLASSID; &fileLog.WriteLine("&oCiTmp4.INSTITUTI ON = " | &oCiTmp4.INSTITUTION); &oCiTmp4.INSTITUTION = &INSTITUTION; End-If; End-While; End-For; rem ***** End: Get/Set Component Interface Properties *****; rem ***** Execute Save *****; If Not &oLvl4CmptIntfc.Save() Then; errorHandler(); throw CreateException(0, 0, "Save failed"); End-If; rem ***** Execute Cancel *****; If Not &oLvl4CmptIntfc.Cancel() Then; errorHandler(); throw CreateException(0, 0, "Cancel failed"); End-If; End-While; catch Exception &ex rem Handle the exception; &fileLog.WriteLine(&ex.ToString()); end-try; &fileLog.WriteLine("End"); &fileLog.Close(); | | Reply to this email to post your response. __.____._ | _.____.__ |
No comments:
Post a Comment