Skip to main content

system.kanoa.lot.deleteRouteStep

Requires kanoaOPS license

Description

Deletes a specific route step from the database.

Syntax

deleteRouteStep(routeStepId, userId)

Parameters:

– routeStepId (int): The ID of the route step to delete.
– userId (int): The ID of the user performing the deletion.

Returns:

– recordsModified (int): Number of records deleted (typically 1).
– message (string): None if success; error message if an exception occurs.

Behavior

The function deletes a route step from the mes.routeStep table.

– Logs the deletion attempt for audit tracking.
– Validates that a valid routeStepId is provided before attempting deletion.
– Executes a parameterized SQL DELETE statement to remove the record.
– Returns the number of affected rows and None if successful.
– Returns an error message if the route step cannot be deleted or if the ID is invalid.

Parameters

ParameterTypeRequiredNotes
routeStepIdintYesID of the route step to delete
userIdintYesID of the user performing the deletion

Code Examples

# Delete a specific route step
recordsModified, msg = system.kanoa.lot.deleteRouteStep(
routeStepId=5001,
userId=123
)
print(recordsModified, msg) # (1, None)

# Attempt to delete with an invalid ID
recordsModified, msg = system.kanoa.lot.deleteRouteStep(
routeStepId=None,
userId=123
)
print(recordsModified, msg) # (None, "Invalid routeStepId")

# Attempt to delete a non-existent route step
recordsModified, msg = system.kanoa.lot.deleteRouteStep(
routeStepId=9999,
userId=123
)
print(recordsModified, msg) # (0, None)