Hello everyone,
I am using PeopleSoft Query 8.8x online, and need to write an expression that looks between two dates (provided by prompts) and does the following:
First, if the Hire Date is between the two prompt dates, it will return "New Hire"
Second, if the Termination Date is between the two dates, it will return "New Term"
Third, if those two conditions are not met, it will simply need to return "Existing"
I have been wrestling with this and cannot quite figure it out. I must use an expression as we do not have access to edit SQL.
Can anyone help?
Thanks in advance,
Ed
| Title | Under | Posted on |
|---|---|---|
| MD5 - SHA checksum of a file. | PeopleSoft Technical | 02/07/2012 - 5:29am |
| nVision Tabular Report through PIA with prompts | PeopleSoft Technical | 02/02/2012 - 10:07pm |
| Can we create an AE to mass update Position - Jobcode data? | PeopleSoft Technical | 01/18/2012 - 3:11am |
| Pay Components on job data can be defaulted and setup based on the rules? | PeopleSoft Functional | 01/05/2012 - 4:58am |
Ed-D you need to use "Case" to accomplish that. on the expression tab, click add expression and then Character on the Expression type drop down. The length box should be large enough to hold the text you want, example "new hire". Now, in the expression Text field, add something like the below:
Click ok when you are done. Again on the Expression page, you need to click on "Use as field" link. This way, the expression will be added to your "Select" fields.
if you look at the "View SQL" page, you should see the expression with your selected fields. Make sure you select hire-date and termination-date fields back as well for the Case to work. Your select should look like:
SELECT hire-DATE, termination-DATE, CASE WHEN hire - DATE BETWEEN date1 AND date2 THEN 'New Hire' WHEN termination - DATE BETWEEN date1 AND date2 THEN 'New Term' ELSE 'Existing' END FROM table1;Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog
Awesome!
Thanks very much, Lepa!!!!! You totally ROCK!!!!!
Best Regards,
Ed
(CASE WHEN B.HIRE_DT BETWEEN (:1) AND (:2) THEN ('New Hire') WHEN B.REHIRE_DT BETWEEN (:1) AND (:2) THEN ('New Hire') WHEN B.TERMINATION_DT BETWEEN (:1) AND (:2) THEN ('Termination') ELSE ('Existing') End)
You will have to create prompts for the between dates (:1) and (:2) - make certain to format the prompts as dates.
Post new comment