Back to top

KVB: How to Verify that an AKI Recipe has been changed?

In KVB there are controls to load a recipe. Example:

Sample Screen:

image

In Edit mode:

image

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.

image

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

image

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:

image

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

image

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

image

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;           
          }
}

image

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:

image

image

The tag must be set to 0 prior to loading a recipe. Two ways to do this are:

  1. 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:

image

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

image

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.