and t he Quer y Tool Presented by: J udi Doolittle (J udi Hotsinpller) and Barbara Sandoval Agenda Introductions Logistics Application Engine (Morning Session) History Program Structure Properties Action Types Break 10 mins MetaSQL and MetaVariables Running an AE Program Printing Options Break 10 mins Sample Review of Take Home Exercise Agenda Cont i nued Query Tool I nt r oduc t i ons Instructor Introductions Student Introductions Logi st i c s Class Format Restroom Location Breaks Appl i c at i on Engi ne Hi st or y Released with Version 8.0 Developed by PeopleSoft Coder Prior Tool COBOL Used for Batch Processing Application Engine Vs. SQR Future Fusion XML Appl i c at i on Engi ne Pr ogr am St r uc t ur e Application Designer Appl i c at i on Engi ne Pr ogr am St r uc t ur e Structure Section Steps Actions Appl i c at i on Engi ne Pr oper t i es General Tab Track changes Document State Tab State Record Attributes Temp Tables Tab Define Set Assign For Batch Processing Build/Rebuild Meta SQL Advanced Tab Gener al Tab St at e Tab Temp Tabl es Tab Advanc ed Tab Ac t i on Types Do When Do While Do Select PeopleCode SQL Call Section Log Message Do Until XSLTOnly shows if it is specified as a Transformation Program Do When It is comparable to an IF statement in other Languages When true returns one or more rows and continue with actions When false exits step Sampl e Do Whi l e Executing step while SQL is true To prevent an endless loop: Requires code in another action The data must change to make the SQL false ExampleProcess sample to count SELECT X FROM PS_TEST_REC WHERE count < = %bind(totemp); Other actions Action that triggers the false UPDATE PS_TEST_REC SET count = count + 1; Do Whi l e Ex ampl e Do Sel ec t Loops through records one at a time Used to populate State Record Three Looping Rules Select/Fetch (Default) ReSelect ReStartable Example of Populating State Record %SELECT(year) SELECT year FROM PS_RUN_CONTROL Do Sel ec t Ex ampl e Peopl eCode Reasons why PeopleCode Used: Manipulate and Manipulation Functions Application Packages Component Interface Reuse Developed Code Refer to PeopleBooks for PeopleCode instruction Peopl eCode Cont i nued Unique to Application Engine How to use State Record in PeopleCode Example PS_TEST_AET.YEAR Return Parameters Exit(1) causes set parameter to executed (Execution can be ABORT, BREAK, or SKIP STEP) Exit(0) default will continue Peopl eCode Cont i nued SQL SQL actions used for INSERT UPDATE DELETE Can be used with any of the Conditional Actions Or by themselves Example UPDATE PS_TEST_REC SET bonus = %bind(bonus) WHERE year = %bind(year) SQL Cont i nued Cal l Sec t i on Allows you to Call another Section Reason is for readability Cal l Sec t i on Cont i nued Example 1 Cal l Sec t i on Cont i nued Example 2 Cal l Sec t i on Cont i nued Example 2 Continued Log Message Writes Messages to the Log File Messages stored in Message Catalog Parameters can be provided as part of the Message To create a custom message use Message Set > 20000 Do Unt i l Another Conditional Action Processes Until Condition is False Needs Another Action to make Condition False Difference between Do While and Do Until Do While pre-processes and checks condition prior to other actions Do Until post-processes and checks condition after other actions Do Unt i l Cont i nued How t o Run Process Definition .Bat File Pr oc ess Def i ni t i ons Pr oc ess Def i ni t i ons Cont i nued .Bat Fi l e \\ServerName\bin\client\winx86\PSAE.exe -CD database -CO USERID CP PASSWORD R RS_TEST_RUN_CONTROL AI PS_TEST_AE Note your PSAE.exe location is unique to your enviroment Description of parameter is immediately following See PeopleBooks for a comprehensive list of Parameter values Met aSQL and Met aVar i abl e Quick Definition SQL Functions Reserved Words Some are Unique to Application Engine Has to be in a SQL Statement Within PeopleCode it can be used in the SQLExec statementnot the most efficient Can use in CREATESQL in PeopleCode %BI ND This is only used in AE Programs Retrieve fields from State Record Example INSERT INTO PS_TEST_REC(emplid, bonus) VALUES (%bind(emplid), %bind(bonus)) %CURRENTDATEI N Returns current system date Example SELECT emplid, effdt FROM PS_J OB WHERE effdt < %CURRENTDATEIN %DATEI N Date variable is used as an input variable Formats Date to Database Date Specifications Example SELECT emplid, effdt FROM PS_J OB WHERE effdt < %DATEIN(2007-12-01) %DATEOUT When selecting a date from the Database to ensure proper format Example %SELECT(emplid, effdt) SELECT emplid, %dateout(effdt) FROM PS_J OB WHERE effdt < %CURRENTDATEIN %OPERATORI D Returns USERID of person running the Application Engine Program Helps you get the correct row from the RUNCNTL Example %SELECT(effdt, erncd, amount) SELECT %dateout(effdt), erncd, amount FROM PS_TEST_RUN_CONTROL WHERE oprid = %OPERATORID %RUNCONTROL Returns RUNCONTROLID that is being used to run the Application Engine Program Example %SELECT(effdt, erncd, amount) SELECT %dateout(effdt), erncd, amount FROM PS_TEST_RUN_CONTROL WHERE oprid = %OPERATORID AND run_cntl_id = %RUNCONTROL %SELECT Used with a DoSelect Stores you data in the AET record Field Names must be valid Fields on the State Record Example %SELECT(emplid, name) SELECT emplid, name FROM PS_TEST_REC %SELECTALL %SELECTALL will select all the fields from the record If the field is a date it automatically uses the %DATEOUT Example Local Record &testrec; &testrec = CreateRecord(PS_TEST_REC) CreateSQL(%SELECTALL(:1), &testrec); Pr i nt i ng PeopleTools Delivers an Option to Print your AE Program Print in Flow Layout or Print in Definition Mode Pr i nt Opt i ons Sampl e Repor t Advanc ed Topi c s Using Email Input and Output Files Usi ng Emai l Application Engine programs can send Emails Used to notify when processes complete Or fail Also to send Notifications to Employees Send Mail Function Used within PeopleCode Example SENDMAIL(0, &EMAIL, , , &SUBJ ECT, &TEXT); For more Options refer to PeopleBooks I nput and Out put Fi l es For interfacing with other Applications Excel, Access, and Text Files Process Declare a Global Variable Path and Filename need to be Explicitly Defined Del i ver ed Func t i ons GetFile This will open a file for read, write or update Example GetFile(&path|&filename, W, %FilePath_Absolute) FileName.Open This will check to see if the file is open Example If &InFile.Open Then Del i ver ed Func t i ons Cont i nued Filename.Writeline This will write to the file. Example &Outfile.WriteLine(&string); Filename.Readline This will read from the file. Example While &Infile.Readline . End-While Sampl e Pr ogr am Walk through Handout Di sc ussi on Ti me Questions and Answers Workshop Quer y Tool