Creating a Business Logic Mechanism to Delete Time Analysis

You can handle deleting a time analysis object through Business Logic (BL). There are use cases where you do not have access to delete the Time analysis (TA) object. Other times, you prefer to delete the time analysis only when the operation deletes. Then you can create a.CATRule to define a BL so you can define limits on deleting a Time analysis.

Create the business logic in a a.CATRule file, then a a.CATRuleExit file calls it. The xx.CATRuleExit file, TESTBJ3_RULE.CATRuleExit has this structure:

<Scripts>
<Script OpeningID="PLMCommandInputValidation"
Type="DELTimeAnalysisRepInstance" ScriptName="TESTBJ3_RULE"
/>
</Scripts>

The TESTBJ3_RULE.CATRule file, called in TESTBJ3_RULE.CATRuleExit, contains the BL authorized by you to restrict the deletion of TA (Time Analysis). It is the following form:

Trace(1", BL called.")

Validation = false

If Validation = false in the CATRule file, then the TA does not delete. Else, if Validation = true in the CATRule file, the TA deletes.

Trace(1,"BL 2 called.")

You also have the freedom of displaying the error message you desire. The following lines can be added to the TESTBJ3_RULE.CATRule file.

Note: Required message needs entering between the two inverted commas.

Parameters.Message = " "

Both the above files are located in the folder win_b64\resources\knowledge\scripts.

Deletion of a time analysis can be done using the contextual command Delete or the action bar command Delete . Executing these commands, Business Logic, the deletion of TA restricts according to the logic in BL.



Sometimes the TA that is restricted by BL, and you can try to delete it with the contextual delete command or by using the Delete Time Analysis command from action bar. As a result, the following error dialog box appears (BL activates to restrict the deletion of time analysis) if no other message defines.