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 |
---|---|---|
Component interface Error: no rows exist for the specified keys | PeopleSoft Technical | 03/15/2019 - 3:54am |
ADD 24 months starting from current month.(peoplesoft) | PeopleSoft Functional | 07/29/2018 - 8:44pm |
TRC values dropdown | PeopleSoft Technical | 04/04/2018 - 12:54am |
how to find missing sequence in GRID and print the mising sequence number while saving through peoplecode | PeopleSoft Technical | 09/11/2017 - 4:49am |
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:
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.