PS Query Lists
Within PeopleSoft Query, you can compare a field with a list of values on the Criteria tab. You have to add each value individually - this is a bit of fun for a handful of values, but when the number of values in the list hit serious double figures, it becomes a bit tedious.
The list of values makes use of the "in" operator in SQL. If we already have the list in an email or spreadsheet, we can edit the list into the SQL format without having to rete the actual values, but then we need to get it into PS Query:
1: Create a new criterion - and make the left hand side an expression.
2: Leave the expression settings as their defaults - a character expression with a length of 1.
3: As an example, to make a list of Departments containing Sales, Marketing, Operations put the following into the expression list:
A.DEPTID in ('SALES','MARKETING','OPERATIONS') and 'a'
4: Click OK and save the expression and return to your new criterion.
5: Add the right hand side of the criterion as the constant value "a" (without the quotes)
Creating the List
Creating a quoted, comma separated list can be done in a text editor, in a spreadsheet or in an online tool such as Regular Expression Calculator.
To convert a list of items one to a line into a SQL "in" list, using the online tool:
1: Open the web address in Chrome, Safari, Firefox or Internet Explorer
2: Put the raw list in the left hand "source" box.
3: Depending on your platform, input the following into the "Regular Expression" box:
- Windows
([^\r]*)
- Mobile Devices
(.+)
4: In the "Replacement Text" box, type in:
'$&',
5: Click "Replace" and your comma separated list appears in the right hand box.
Note that if using direct from Twitter, copy the web address to your browser rather than the Twitter version:
http://www.springboardsolutions.com/regular_expression.html
The PeopleSoft Users Companion is a Kindle eBook packed with hints and tips on using the PeopleSoft web more effectively. Get your copy today.
Related Reading
For more information about functions in PeopleSoft Query and some other interesting stuff too, read our eBook: |