You are not allowed to update your own data
You are not allowed to update your own data is error of EMPLID field
you can use this syntax peoplecode
AllowEmplidChg(true)
You are not allowed to update your own data is error of EMPLID field
you can use this syntax peoplecode
AllowEmplidChg(true)
How to send multiple pdf files in email by peoplecode of peoplesoft. You can use this code for send other type of file such as txt, csv.
&filenamepaht1=””C:\temp\filename1.pdf””;
&filenamepaht2=””C:\temp\filename2.pdf””;
&filenamepaht2=””C:\temp\filename-.pdf””;
&MAIL_FILES=&filenamepaht1| “”;”” |&filenamepaht2| “”;”” |&filenamepaht3;
&MAIL_TITLES = “”filename1.pdf;filename2.pdf;filename3.pdf””;
&RET = SendMail(&MAIL_FLAGS, &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_SENDER, “”;””, &CONTTYPE);
How to use Createsql in Peoplecode? You can use createsql for dynamic SQL or static sql of each purpose. There are many ways you can create SQL text.
Syntax of Create SQL
CreateSQL([{sqlstring | SQL.SqlName}[, paramlist]])
Where paramlist is an arbitrary-length list of values in the form:
inval1 [, inval2] ..
Use the CreateSQL function to instantiate a SQL object from the SQL class and opens it on the given sqlstring and input values. sqlstring is a PeopleCode string value giving the SQL statement.
Any errors in the SQL processing cause the PeopleCode program to be terminated with an error message.
You can use CreateSQL with no parameters to create an empty SQL object that can be used to assign properties before being populated and executed.
Example 1: You want to select all employee name and blood of deptid and mgrid.
You can create dynamic sql to text in peopolecode such as
&RPT = “select emplid,name,blood form table where deptid = :1 and MGRID=:2”
Local SQL &sql2 = CreateSQL(&RPT, TABLE.DEPTID, TABLE.MGRID);
While (&sql2.Fetch(&emplid,&name,&blood))
&file.WriteLine(&emplid | “‘”|&name | “‘”| &blood);
End-While;
&SQL_RPT = MsgGetExplainText(20003, 107, “Message not found.”, TABLE.DEPTID, TABLE.MGRID);
&sql1 = CreateSQL(&SQL_RPT);
convert hijri to gregorian oracle by use sql at below syntax
SELECT TO_CHAR(SYSDATE, ‘DD-MM-YYYY’, ‘NLS_CALENDAR=”English Hijrah”’) FROM DUAL
select TO_DATE(’24/08/1439′,’dd/mm/yyyy’,q'[nls_calendar=’English Hijrah’]’) from dual
Ref:docs.oracle.com/cd/B19306_01/server.102/b14237/initparams119.htm#REFRN10116
How to use oracle nls_calendar thai buddha by sql. You can use sql at below
SELECT TO_CHAR(sysdate, ‘DD MON YYYY’, ‘nls_calendar=”Thai Buddha” nls_date_language = Thai’) DATE_CHAR FROM dual
SELECT TO_CHAR(SYSDATE, ‘DD-MM-YYYY’, ‘NLS_CALENDAR=”Thai Buddha”’) FROM DUAL
SELECT TO_CHAR(SYSDATE, ‘DD/MM/YYYY’, ‘NLS_CALENDAR=”THAI BUDDHA” NLS_DATE_LANGUAGE=THAI’) FROM DUAL
How to Convert Date Format using Peoplecode in Peoplesoft by function is DateTimeToLocalizedString of peoplesoft
&StartDT = DateTimeToLocalizedString(DERIVED_TT.KTB_START_DT, “yyyyMMdd”);
&DT= DateTimeToLocalizedString(%date, “dd-MM-yyyy”);
For example on how to apply the above function.
%date in as 2018-09-07 out as 20180907:
&date = DateTimeToLocalizedString(%Date, “yyyyMMdd”);
%Datetime in as 2018-09-07.15.41.000000 out as 20180907-154109:
&datetime = DateTimeToLocalizedString(%Datetime, “yyyyMMdd-HHmmss”);
For input or output of the current date or time:
The %CurrentDateIn meta-SQL variable expands to a platform-specific SQL substring representing the current date in the Where clause of a SQL Select or Update statement, or when the current date is passed in an Insert statement.
The %CurrentDateOut meta-SQL variable expands to platform-specific SQL for the current date in the Select clause of a SQL query.
The %CurrentDateTimeIn meta-SQL variable expands to a platform-specific SQL substring representing the current datetime in the Where clause of a SQL Select or Update statement, or when the current date time is passed in an Insert statement.
The %CurrentDateTimeOut meta-SQL variable expands to platform-specific SQL for the current datetime in the Select clause of a SQL query.
The %CurrentTimeIn meta-SQL variable expands to a platform-specific SQL substring representing the current time in the Where clause of a SQL Select or Update statement, or when the current time is passed in an Insert statement.
The %CurrentTimeOut meta-SQL variable expands to platform-specific SQL for the current time in the Select clause of a SQL query.
For input or output of any date or time:
The %DateIn meta-SQL variable expands into platform-specific SQL syntax for the date. Use %DateIn whenever a date literal or Date bind variable is used in a comparison in the Where clause of a Select or Update statement, or when a Date value is passed in an Insert statement.
Restrictions Using COBOL
You can only use string literals when using this construct in COBOL. You cannot use it with bind parameters in COBOL. For example, the following works in COBOL:
1 |
UPDATE PS_PERSONAL_DATA SET LASTUPDT = %DATEIN('2018-09-07') |
The following SQL fails:
1 |
UPDATE PS_PERSONAL_DATA SET LASTUPDT = %DATEIN(:1) |
The %DateOut meta-SQL variable expands to either a platform-specific SQL substring or datetime value, depending on the database platform, representing a datetime column in the Select clause of a SQL query
The %DateTimeIn meta-SQL variable expands to platform-specific SQL for a DateTime value in the Where clause of a SQL Select or Update statement, or when a DateTime value is passed in an Insert statement.
You can only use string literals when using this construct in COBOL. You cannot use it with bind parameters in COBOL. For example, the following works in COBOL:
1 |
UPDATE PS_PERSONAL_DATA SET LASTUPDTTM = %DATETIMEIN('2002-12-11-11.59.00.000000') |
The following SQL fails:
1 |
UPDATE PS_PERSONAL_DATA SET LASTUPDTTM = %DATETIMEIN(:1) |
%TimeIn expands to platform-specific SQL for a Time value in the Where clause of a SQL Select or Update statement, or when a time value is passed in an Insert statement.
You can only use string literals when using this construct in COBOL. You cannot use it with bind parameters in COBOL. For example, the following works in COBOL:
1 |
UPDATE PS_PERSONAL_DATA SET LASTUPTM = %TIMEIN('11:59:00:000000') |
The following SQL fails:
1 |
UPDATE PS_PERSONAL_DATA SET LASTUPTM = %TIMEIN(:1) |
When input date/time goes in the WHERE clause (conditions) and output date/time goes in the SELECT clause (returned data).
For input/output of a null date/time:
For getting part of a date/time:
For date arithmetic:
1 2 |
SQLExec("Select %dateadd(%datein('2018-09-07') , 12) from PS_INSTALLATION_TR", &add); WinMessage(&add); |
1 2 3 4 5 6 7 |
%DateDiff(%DateIn('1997-01-01'), %DateIn("1966-06-30')) %DateDiff( date1_column, date2_column) %DateDiff ( %DateAdd(date1_column, 30), date2_column) |
The following usage is illegal (always use %Datein for inputting date literals):
1 |
%DateDiff('1997-01-01', '1996-06-30') (should use %DateIn for inputting date literals) |
The following example returns the difference in hours between the current datetime and the requested datetime:
1 |
%DateTimeDiff(%CurrentDateIn, RQSTDTTM) < " | RECORD.FIELDNAME * 60; |
The following example returns the difference in minutes:
1 |
%DateTimeDiff(%CurrentDateIn, RQSTDTTM) < " | RECORD.FIELDNAME; |
References:
http://peoplesoft.wikidot.com/date-and-time-in-meta-sqlhttps://docs.oracle.com/cd/E57990_01/pt853pbh2/eng/pt/tape/langref_UsingApplicationEngineMeta-SQL-0771d9.html#topofpage
How to use peoplesoft application engine trace.
1. Go to the process definition of that AE(Application Engine) in menu PeopleTools > Process Scheduler > Processes.
2. Go to Override options of Precess AE.
3. Choose parameter list –> Append –> Add “”-TRACE 3″”
4. Save the process definition.
5. Run the process and go to the view log/trace and you will find the trace.
-TRACE output goes into Application Engine Trace (.AET)
-TOOLSTRACEPC output goes into the PeopleTools trace file (.trc)
or use -TRACE 7 -TOOLSTRACEPC 3596 -TOOLSTRACESQL 31
or use -TRACE 7 -TOOLSTRACEPC 4044
Ref: it.toolbox.com/question/debugging-an-application-engine-061405
Ref:docs.oracle.com/cd/E41633_01/pt853pbh1/eng/pt/tape/task_EnablingApplicationEngineTracing-077149.html
How to use sqlexec peoplecode for select update insert or delete of each requirements by syntax of function in peoplesoft.
sqlexec ({sqlcmd | SQL.sqlname}, bindexprs, outputvars)
The sqlexec function can only select a single row of data. If your sql statement (or your sql.sqlname statement) retrieves more than one row of data, the function peoplecode send result only the first row to its output variables.
For example
sqlexec(“select name from ps_name where emplid =:1”,&Emplid,&Name_Emp);
/*———————————————————-*/
sqlexec(SQL.SELECT_NAME,&Emplid,&Name_Emp);
/*———————————————————-*/
&sqltext = “select name from ps_name “;
&sqltext = &sqltext | ” where emplid =:1″;
SQLExec(&sqltext, &Emplid,&Name_Emp);
How to use LongTranslateValue and ShortTranslateValue for get description of translate value of field.
ShortTranslateValue Systax :
&VALUE = &MYFIELD.ShortTranslateValue;
LongTranslateValue Systax :
&VALUE = &MYFIELD.LongTranslateValue;
How to Disable Saving Page Warning Peoplesoft by check box at component properties. Checking this field (Disable Saving Page) will will suppress the save warning.
Disable Saving Page
Select when you want to hide the Save button in the toolbar and disable the Alt+1 (Save) hot key. Selecting this option prevents users from being prompted to save when exiting a page. However, it does not prevent using PeopleCode to save a page with the DoSave() or DoSaveNow() functions. This functionality can be helpful for applications in which the user is not making database changes and does not need to be prompted to save.
Ref: https://docs.oracle.com/cd/E41633…/task_SettingComponentProperties-0774bd.htm