KVB: How to Verify that an AKI Recipe has been changed?
In KVB there are controls to load a recipe. Example:
Sample Screen:

In Edit mode:

Sometimes a user would like verification that a new recipe has been loaded. The following describes two methods for doing this.
Method 1
Add the System Tag “LatestLoadedRecipeName” and tie it to a string variable (example: LastRecipeLoadedName) in the PxMM. The PxMM will know if the recipe has been loaded if the recipe name changes.

When the recipe changes a AKI popup message could also be displayed:

The popup is created in kvb as a new screen and can appear automatically when “LatestLoadedRecipeName” changes by setting up in the Actions field: Show Screen” action:

The message window can be closed by using a button and tying to a close screen action when clicked as follows:

The System Tag “LatestLoadedRecipeName” can be connected to a PxMM Dictionary variable using the KVB C# script language:

For copying and pasting:
public partial class Tags { void SystemTagLatestLoadedRecipeName_ValueChange(System.Object sender, Core.Api.DataSource.ValueChangedEventArgs e) { Globals.Tags.LastRecipeLoadedName.Value = Globals.Tags.SystemTagLatestLoadedRecipeName.Value; } }

Method 2
By adding a bool tag (variable) and predefining as 1 (to confirm when the recipe is loaded). Example: The tag (variable) RecipeConfirm in the recipe below:


The tag must be set to 0 prior to loading a recipe. Two ways to do this are:
- When the recipe successfully loads popup the message box already described and use the OK button to reset the variable. In this case it is tied to the tag RecipeConfirm as follows:

- In the PxMM program add a timer that resets the tag after a few seconds:

For copying and pasting:
IF RecipeConfirm =1 THEN On_Timer1(TRUE, T#3s); IF On_Timer1.Q THEN RecipeConfirm := 0; On_Timer1(FALSE, T#3s); END_IF; END_IF;
Attached is a sample project with some of the elements included. Slight modifications may be needed based on the method you decide to use.
Home >
Knowledge Base >
FAQs >
Downloads >