Local File &fileLog;
Local ApiObject &oSession, &oUodaStdntGroupsPersCi;
Local ApiObject &oPersnlFerpaVwCollection, &oPersnlFerpaVw;
Local ApiObject &oSrvcIndSelVwCollection, &oSrvcIndSelVw;
Local ApiObject &oStdntGrpsCollection, &oStdntGrps;
Local ApiObject &oStdntGrpsHistCollection, &oStdntGrpsHist;
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;
rem &fileLog.WriteLine(&sErrType | " (" | &sErrMsgSetNum | "," | &sErrMsgNum | ") - " | &sErrMsgText);
End-For;
rem ***** Delete the Messages from the collection *****;
&oPSMessageCollection.DeleteAll();
End-Function;
try
&oSession = %Session;
&oSession.PSMessagesMode = 1;
rem ***** Get the Component Interface *****;
&oUodaStdntGroupsPersCi = &oSession.GetCompIntfc(CompIntfc.X_STDNT_GROUPS_PERS_CI);
If &oUodaStdntGroupsPersCi = Null Then
errorHandler();
throw CreateException(0, 0, "GetCompIntfc failed");
End-If;
rem ***** Set the Component Interface Mode *****;
&oUodaStdntGroupsPersCi.InteractiveMode = False;
&oUodaStdntGroupsPersCi.GetHistoryItems = True;
&oUodaStdntGroupsPersCi.EditHistoryItems = False;
rem ***** Set Component Interface Get/Create Keys *****;
&oUodaStdntGroupsPersCi.EMPLID = "2250030300";
rem ***** Execute Get *****;
If Not &oUodaStdntGroupsPersCi.Get() Then
rem ***** No rows exist for the specified keys.*****;
errorHandler();
throw CreateException(0, 0, "Get failed");
End-If;
rem ***** Begin: Get/Set Component Interface Properties *****;
rem ***** Set/Get STDNT_GRPS Collection Field Properties -- Parent: PS_ROOT Collection *****;
&oStdntGrpsCollection = &oUodaStdntGroupsPersCi.STDNT_GRPS;
Local integer &i121;
rem For &i121 = 1 To &oStdntGrpsCollection.Count;
&oStdntGrps = &oStdntGrpsCollection.insertItem(1);
&oStdntGrps.INSTITUTION = "UABC";
&oStdntGrps.STDNT_GROUP = "W001";
rem ***** Set STDNT_GRPS_HIST Collection Field Properties -- Parent: STDNT_GRPS Collection *****;
&oStdntGrpsHistCollection = &oStdntGrps.STDNT_GRPS_HIST;
Local integer &i224;
rem For &i224 = 1 To &oStdntGrpsHistCollection.Count;
&oStdntGrpsHist = &oStdntGrpsHistCollection.Item(1);
&oStdntGrpsHist.EFFDT = %Date;
&oStdntGrpsHist.EFF_STATUS = "A";
rem End-For;
rem End-For;
rem ***** End: Get/Set Component Interface Properties *****;
rem ***** Execute Save *****;
If Not &oUodaStdntGroupsPersCi.Save() Then;
throw CreateException(0, 0, "Save failed");
End-If;
rem ***** Execute Cancel *****;
If Not &oUodaStdntGroupsPersCi.Cancel() Then;
errorHandler();
throw CreateException(0, 0, "Cancel failed");
End-If;
catch Exception &ex
rem Handle the exception;
rem &fileLog.WriteLine(&ex.ToString());
MessageBox(0, "", 0, 0, "" | &ex.ToString());
end-try;
rem &fileLog.WriteLine("End");
No comments:
Post a Comment