If then logic work around with filters

I am pulling tags from Enterprise PI Historian and trying to perform conditional calculations to calculate equipment throughput in containers per minute based on belt speed. Each recipe has a different speed and a different factor I need to multiply by to get the throughput. Is there a way to do this dynamically based on the recipe tag without having to manually change a variable for the recipe?

hello @kkin ,
Could you please let me know which data source is being used and provide sample data, screenshorts for better understanding.

Data source is “Enterprise-PI-Historian”. Belt speed tag comes in as an int in mm/min. This value varies automatically as the machine adjusts for the speed of equipment upstream and downstream. Recipe tag comes in as a 1 of 5 strings (for 1 of 5 different recipes). This will be constant for each batch while the belt is running but can vary batch to batch. Each recipe is for a container of different diameter so will have a different throughput (containers/min) that I want the value of. I have scalar factors based on each container size I can multiply the belt speed by to get the value for containers per minute.

The problem is only showing the value for the output based on the active recipe name. This is the basic logic I want to follow:

RecipeName = Str from PI
BeltSpeed = INT from PI
output = calculated INT

If RecipeName = “Recipe1”,
output = BeltSpeed2.5
ELSE IF Recipe Name = “Recipe2”,
output = BeltSpeed
3
etc.

and then display the output as a field along with other fields. Not sure if there is a way to do this by doing the calculation on all recipes and then filtering out the columns for the recipes that do not equal the recipe name string leaving just the output for the active recipe.