<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">On Jan 21, 2015, at 7:07 AM, Kevin Squire <<a href="mailto:gentgeen@wikiak.org" class="">gentgeen@wikiak.org</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">I have a scrip currently that checks for status change from X--> Y and if true, adds an entry to the Custom Field "RMA Num".  It adds our RMA number, which is really just "RMA-$RT_Ticket_Number"</div><div class=""><br class=""></div><div class="">They have asked me to change the number based on another CF "RMA TYPE".  If the RMA type = "Student Withdrawl" they want the RMA number to be appended with "WD"</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">My perl skills are limited to copy/paste and tweaking existing.... so I would like a little bit of help with my If/Then statement.  The idea being:</div><div class=""><br class=""></div><div class="">IF CustomField{RMA Type} = Student Withdrawl</div><div class="">THEN $Append = "-WD"</div><div class="">ELSE $Append = ""  </div><div class=""><br class=""></div><div class="">Then in the current line (below) </div><div class="">             <span style="font-family:monospace,monospace" class="">my $Value = "RMA-" . $Num ;</span></div><div class=""><span style="font-family:monospace,monospace" class=""><br class=""></span></div><div class=""><span style="font-family:monospace,monospace" class="">would be changed to</span></div><div class=""><span style="font-family:monospace,monospace" class="">      m</span><span style="font-family:monospace,monospace" class="">y $Value = "RMA-" . $Num . $Append ;</span></div></div></div></blockquote><div><br class=""></div><div>This can be done with one ternary operator:</div><div>my $value = $self->TicketObj->FirstCustomFieldValue('RMA Type') eq 'Student Withdrawl' ? <span style="font-family: monospace, monospace;" class="">"RMA-" . $Num : </span><span style="font-family: monospace, monospace;" class="">"RMA-" . $Num . $Append;</span></div><div><br class=""></div><div>Some notes:</div><div>- The condition here is:  $self->TicketObj->FirstCustomFieldValue('RMA Type') eq 'Student Withdrawl'</div><div>- If the condition is true then $value will equal what's between the ? and the : (colon)</div><div>- If the condition is false then $value will equal what's between the : and the ; (semi-colon)</div><div><br class=""></div><div>Landon Stewart : <a href="mailto:lstewart@iweb.com" class="">lstewart@iweb.com</a></div></div><div class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Lead Specialist, Abuse and Security Management<br class="">Spécialiste principal, gestion des abus et sécurité<br class=""><a href="http://iweb.com" class="">http://iweb.com</a> : +1 (888) 909-4932</div><div class=""><br class=""></div></div></div></div></body></html>