Switch statement

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2009 10:24 AM
FWIW, I was looking for info to see if I could use a switch statement in a transform script rather than a bunch of if/else. I found no examples in the forums or wiki so I gave it a try. It worked! Here's my solution to take a single character from our HR database on a pay code (S, H, or E) and populate our own field with words.
switch (source.u_paycode.toString()) {
case 'S': target.u_paycode = "Salaried Exempt"; break;
case 'E': target.u_paycode = "Salaried Non-Exempt"; break;
case 'H': target.u_paycode = "Hourly"; break;
default: target.u_paycode = "Hourly";
}
Switch statements are an elegant solution. These work just as expected in JavaScript.
- 11,048 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 09:24 PM
HA HA! That's a good one Phillip. Glad you got it figured out.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 07:50 AM
Hi Chuck
Can we use switch statement in jelly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 04:54 AM
Yes. It's covered in episode 1 of TechNow. Below is a partial screenshot (ignore the smart quotes PowerPoint inserted.)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 07:21 AM
Thanks and i will go through that .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 07:27 AM
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thank you