Example: Prompting for Global and Class-Level Information Input
The following example demonstrates the use of global and class-level prompts.
import PT_DIAGNOSTICS:*;
class GetRecFieldsBeginningWith extends PT_DIAGNOSTICS:PTDiagnostics
/* Constructor */
method GetRecFieldsBeginningWith();
/* Public Method */
method GetDiagnosticInfo();
method GetDynamicPrompt();
method IsPlugIn();
private
end-class;
method GetRecFieldsBeginningWith;
Local boolean &status;
%Super = create PT_DIAGNOSTICS:PTDiagnostics();
&status = %Super.SetProperty(%This, "Where", "Boolean", True);
&status = %Super.SetProperty(%This, "Purpose", "String", "This is a diagnostic
to print out a listing of fields from records in your PeopleSoft database that
matches search criteria. This diagnostic tests globalType and classType
prompting. The global prompt is retrieved from inputs defined by a different
class in this plug-in.");
end-method;
method GetDynamicPrompt
Local boolean &status;
Local string &sError;
/* define the global prompt*/
&status = %Super.InsertQuestion("Recs", "Enter RecordNames to retrieve,
beginning with:", "String", True);
/* define prompt for this class */
&status = %Super.InsertQuestion("Flds", "Enter FieldNames to retrieve,
beginning with:", "String", False);
end-method;
method GetDiagnosticInfo
Local boolean &status;
Local string &sValRecs, &sValFlds, &sError;
Local number &iCount = 0;
Local Record &REC;
Local boolean &bReturn;
Local SQL &SQL1;
&REC = CreateRecord(Record.PSRECFIELD);
&SQL1 = CreateSQL("%SelectAll(:1) where RECNAME LIKE :2 and FIELDNAME LIKE :3");
/* get global prompt */
&status = %Super.GetUserInputByKey("Recs", &sValRecs);
/* get class prompt */
&status = %Super.GetUserInputByKey("Flds", &sValFlds);
&SQL1.Execute(&REC, Upper(&sValRecs | "%"), Upper(&sValFlds | "%"));
While &SQL1.Fetch(&REC)
&iCount = &iCount + 1;
&status = %Super.InsertData("String", "Record: " | &REC.RECNAME.Value | "
has the following field that matches your criteria: ", &REC.FIELDNAME.Value);
End-While;
end-method;
method IsPlugIn
end-method;
If you only need to define the class level prompt, use only the second InsertQuestion() method in the GetDynamicPrompt() method and one GetUserInputByKey().
If the message is not required during the dynamic input, then pass an empty string in the second parameter of the InsertQuestion() method.