Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force custom function rsaStatus to equal "OnTime"

Status
Not open for further replies.

capronton

MIS
Jun 28, 2013
159
US
If DateDiff ("s", {incident_log.sched_time},{incident_log.incident_date_time} ) < -30 then "Early" else
If DateDiff ("s", {incident_log.sched_time},{incident_log.incident_date_time} ) > 330 then "Late" else "OnTime"




I have this function called rsaStatus with the code listed above. However I want to force "rsaStatus" to be "OnTime"
under certain conditions.

For example, regardless of the difference between sched_time and incident_date_time if the conditions below exist
I want to set rsaStatus to "OnTime"

How can I add the conditions below to the script above without creating errors?


If route = 110 and direction = north
then "OnTime"

If route = 103 and direction = south
then "OnTime"

If route = 101 and direction = east
then "OnTime"

If route = 107 and direction = west
then "OnTime"

Thanks for any assistance.
 
So this is a custom function that you call using the syntax

rsaStatus( {incident_log.sched_time},{incident_log.incident_date_time})

So now you would need to pass in two additional values, route and direction. Just make sure you test for them before looking at the time, otherwise the route/direction piece would never get evaluated.

Code:
 If route = 110 and direction = north 
 then "OnTime"
else
 If route = 103 and direction = south
 then "OnTime"
else
 If route = 101 and direction = east
 then "OnTime"
else
 If route = 107 and direction = west
 then "OnTime"
else
If DateDiff ("s", {incident_log.sched_time},{incident_log.incident_date_time} ) < -30 then "Early" 
else
 If DateDiff ("s", {incident_log.sched_time},{incident_log.incident_date_time} ) > 330 then "Late" 
else "OnTime"

You'll need to modify this, but it's the basic logic.

 
This looks to me to be the same issue that you raised in thread767-1750056. Please do not commence multiple threads on the same topic.

Did you do as I suggested for troubleshooting purposes in that earlier threat? If not, why not? If you did, what was the outcome.

Cheers
Pete

 
Thanks Brian,

This is my first opportunity to respond. I solved the problem using the syntax below.

If {incident_log.current_route_id} = 987 and {direction_codes.direction_description} like "*SOUTH*" and {@earlyLate} = "Early" and {incident_log.tp_id} = 200
then "OnTime" else
If {incident_log.current_route_id} = 987 and {direction_codes.direction_description} like "*SOUTH*" and {@earlyLate} = "Early" and {incident_log.tp_id} = 58
then "OnTime" else
If {incident_log.current_route_id} = 987 and {direction_codes.direction_description} like "*SOUTH*" and {@earlyLate} = "Early" and {incident_log.tp_id} = 292
then "OnTime" else
If {incident_log.current_route_id} = 103 and {direction_codes.direction_description} like "*NORTH*" and {@earlyLate} = "Early" and {incident_log.tp_id} = 12763
then "OnTime" else {@earlyLate}

Will do Pmax.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top