Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

I'm using File Layout and CI for load employees into PS.

Basically, the line has the necessary for load Personal Data (names, address, national ids...) and Job Data (positions, departments, jobcodes, BUs...). The thing is: if i dont find any position, department, etc.. i must create it and give it the proper security for load it using the Job Data CI. The issue comes when i read the description of any of these data, for example, a department. The description in the file has 30 characters, that's ok, but has a character with accent (, , , any of these...), and that causes that the File Layout read as if had 31, interrupting the process. For now on, i can remove these characters from the description, but i would like if there is any specific charset i must set when i do the GetFile(&Path, "r", &Charset, %FilePath_Absolute) in order to read the character with accent as one and no as two different, and load it as appears in the file.. Answer: Try this character set.
ISO-8859-1

Meta-SQL
One of the most useful development shortcuts in PeopleSoft is Meta-SQL. If you don't know about Meta-SQL then this example of how to refactor standard SQL to Meta-SQL should help you get an idea of what it can do.

The Example - PeopleTools SQL Definition Data


In this example, the following tables are used to return information about stored PeopleTools SQL definitions: Table
PSSQLDEFN

Description SQL Definitions SQL Definition Text Actual Stored SQL

Key Fields
SQLID, SQLTYPE

PSSQLTEXTDEFN

SQLID, SQLTYPE, MARKET, DBTYPE, EFFDT, SEQNUM

Here's how you might write a query that joins these records to give you the latest effective dated unique fields from these tables:
select S.SQLID, S.SQLTYPE, S.VERSION, S.LASTUPDOPRID, S.LASTUPDDTTM, S.ENABLEEFFDT, S.OBJECTOWNERID, ST.MARKET, ST.DBTYPE, ST.EFFDT, ST.SEQNUM, ST.SQLTEXT from PSSQLDEFN S, PSSQLTEXTDEFN ST where ST.SQLID = S.SQLID and ST.SQLTYPE = S.SQLTYPE and ST.EFFDT = ( select from max(EFFDT) PSSQLTEXTDEFN

where and and and and and ) ;

SQLID = ST.SQLID SQLTYPE = ST.SQLTYPE MARKET = ST.MARKET DBTYPE = ST.DBTYPE SEQNUM = ST.SEQNUM EFFDT <= sysdate

Note that the SEQNUM field is used to partition long SQL statements. If you have a SQLID with a SEQNUM greater than 0, it is because it is too long to fit in one row for the SQLTEXT long field. Since you would want to return all SEQNUM rows, there is no need to add any conditions for SEQNUM in the query above.

Refactoring with Meta-SQL


The refactoring steps for the above SQL statement include:
y y y

Replacing the hard coded database table names with %Table and the PeopleSoft record definition names Using %Join to perform the join on common keys between PSSQLDEFN and PSSQLTEXTDEFN Replacing the effective date logic with %EffdtCheck

Here's how the Meta-SQL looks after these changes:


SELECT S.SQLID , S.SQLTYPE , S.VERSION , S.LASTUPDOPRID , S.LASTUPDDTTM

, S.ENABLEEFFDT , S.OBJECTOWNERID , ST.MARKET , ST.DBTYPE , ST.EFFDT , ST.SEQNUM , ST.SQLTEXT FROM %Table(PSSQLDEFN) S , %Table(PSSQLTEXTDEFN) ST WHERE %Join(COMMON_KEYS, PSSQLDEFN S, PSSQLTEXTDEFN ST) AND %EffdtCheck(PSSQLTEXTDEFN ST_ED, ST, %CurrentDateTimeIn)

Show the resolved Meta-SQL Note that because we are selecting fields from more than one table (and not all the fields), the %SelectAll construct is not going to work in this case.

Thoughts on using Meta-SQL


Meta-SQL isn't a silver bullet. There are legitimate cases when you shouldn't use it because it simply can't do what you want or because it does it poorly (e.g. performance). In terms of aesthetics, Meta-SQL doesn't support ANSL SQL join syntax, however the benefits of using Meta-SQL usually outweigh the aesthetic costs. There are a few Meta-SQL conventions that you should always try to use:
y y

The relevant Meta-SQL date and time functions constructs The %Table construct with record names instead of database table names. See this article about why you should be doing this. Essentially, like the other MetaSQL constructs it reduces the impact of changes to the system to your code.

Remember to always resolve your Meta-SQL to verify that it creates the correct SQL statement for your database platform.

All about PeopleSoft Portal Registry


What is Portal Registry? Portal Registry is a collective term used for describing the online navigational structure of the PeopleSoft Internet Architecture (PIA) portal. The portal is a collection of folders and content references. A folder can contain another folder or a content reference (cref). Creation of PeopleSoft Portal Registry Definitions: PeopleSoft Portal Registry definitions are created while registering the component. Portal registry entries can be migrated from one environment to other as a PeopleSoft object. However Portal Registry entries are not supported to be viewed in Application Designer. What to do when Portal Registry Definitions are not showing up in Menu Pagelet? Sometimes Portal registry entries don't appear after migration, sometimes don't appear after registering the component. One simple reason is the security defined. If the user has access to the created portal registry entry then do the below: 1) Double check that the portal registry entries have been migrated or created successfully. Navigate to: PeopleTools -> Portal -> Structure and Content Then navigate to the Folder(s), Content reference where the created portal entry should be. Ideally they should have been created/migrated. While doing this, refer the Permission List assigned to the content reference and verify that the user trying to access the cref is a member of this permission list. 2) Check the database using the following query to ensure your content references/folders exist: SELECT * FROM PSPRSMDEFN WHERE PORTAL_OBJNAME LIKE '%Reqd_Portal_Object_Name%' ; If this query does not return a row for the required Portal object name then make sure that the intended portal registry definition is included in the project and the Action and Upgrade flags are set as desired. If there is a row/entry for the Portal registry then clear the cache in the client and this would display the new content reference created. If this does not solve, then add a dummy entry to the portal registry. This dummy portal registry save will force a cache refresh and will solve the cache issue if it's a cache issue at server level. Without bringing the app server or web server to clear the cache this is a good way to delete(refresh) the cache. However don't forget to delete the dummy entry created. To find the portal registry entries in PeopleSoft, Verity search engine uses Registry search index. The PORTAL_INDEX application engine builds the registry search index. Click here to find more about Verity Search Engine, PORTAL_INDEX AE and Registry Search Index.

Sample code to read a file using file layouts and to insert data into a record
Sample code to read a file using file layouts and to insert data read into a record. Local Local Local Local File &MYFILE; Record &REC; array of string &ARRAY; string &FILE_DIRECTORY, &FileName;

&FileName = "MY_FILE_NAME.txt"; &FILE_DIRTORY = "/MYDIRECTORY/" /*open file for reading*/ &MYFILE = GetFile(&FILE_DIRECTORY &FileName, "R", %FilePath_Absolute); /*create record object*/ &REC = CreateRecord(Record.MY_RECORD); &ARRAY = CreateArrayRept("", 0); /*check if file is open*/ If &MYFILE.IsOpen Then /*The SetFileLayout method is a file layout method. It associates a specific file layout definition with the file object executing this method, providing easy access to rowset data.(PeopleBooks)*/ If &MYFILE.SetFileLayout(FileLayout.FILE_LAYOUT_NAME) Then /*read line into &STRING*/ While &MYFILE.ReadLine(&STRING); &ARRAY = Split(&STRING, ","); For &I = 1 To &REC.FieldCount &REC.GetField(&I).Value = RTrim(LTrim(&ARRAY [&I])); End-For; /* do additional processing here for converting values */ &REC.Insert(); /*count rows inserted into record*/ &COUNT = &COUNT + 1; End-While; Else /* do error processing - filelayout not correct */ End-If; Else /* do error processing - file not open */ End-If;

You might also like