Skip to main content

system.kanoa.quality.sheet.revertSheetVersionState

Requires kanoaQDS license

Description

Reverts an archived check sheet back to In Revision. If a check sheet is already In Revision for the same master, that sheet is archived and renamed before the target archived sheet is promoted to In Revision with an incremented version number and updated naming.

Syntax

revertSheetVersionState(masterChkShtId, chkShtId, userId)

Parameters:

– masterChkShtId (int): Master check sheet ID.
– chkShtId (int): Archived check sheet ID to revert.
– userId (int): User performing the reversion.

Returns:

– recordsModified (int): Number of records modified.
– message (string or None): None if success; error details on failure.

Behavior

The function:

– Finds the archived version entry for the given chkShtId.
– If an In Revision sheet exists for the same master, archives it and renames it using the released name plus its version number.
– Sets the archived sheet to In Revision, increments its version number to the next available, and updates version history.
– Renames the reverted sheet using the released name and its original version (e.g., “<ReleasedName> verX - In Revision”).
– Ensures the reverted sheet’s masterChkShtId is set to the provided master ID.

Parameters

ParameterTypeRequiredNotes
masterChkShtIdintYesMaster ID of the check sheet group containing the archived sheet
chkShtIdintYesID of the archived check sheet to set to In Revision
userIdintYesUser performing the operation

Code Examples

# Revert an archived sheet back to In Revision
records_modified, msg = system.kanoa.quality.sheet.revertSheetVersionState(
masterChkShtId=1001,
chkShtId=3003, # archived sheet id
userId=123
)
print(records_modified, msg)