QUOTE(b_carlton @ Jun 29 2008, 09:40 PM) [snapback]70957[/snapback]
I make a User Defined Type which is the array. I'm sure the ten different items in the array standf for different things. This is a great opportunity to break them out. The UDT can contain the ten individual items as their own DINT. Let's call the UDT 'MyRecipe'. Let's say the DINTS are named Ingredient1, Ingredient2 etc. If you know specifically what the ingredients are then name them as such instead of the generic 'Ingredient'
Once you have the UDT defined create a single instance as a tag called 'CurrentProduct' of type MyRecipe. This will have the components CurrentProduct.Ingredient1, ... CurrentProduct.Ingredient9
Also create a tag 'RecipeStorage' of type MyRecipe but being an array 10 long. This will have:
RecipeStorage[0].Ingredient1 ... RecipeStorage[0].Ingredient9
...
...
...
RecipeStorage[9].Ingredient1 ... RecipeStorage[9].Ingredient9
Now it's just COP CurrentProduct RecipeStorage[ProductSelected] 1 to store and COP RecipeStorage[ProductSelected] CurrentProduct 1 to Read.
If you ever decide to expand the number of ingredients you can, while offline and having uploaded all current data, add another DINT to the UDT definition. This will change the size of CurrentProduct as well as all ten RecipeStorage items. All the original info will be in place. After downloading, you now just have to add the data for the new ingredient.
And of course to add to the number of recipes you just increase the RecipeStorage array size in the same manner while offline.
Thanks b_carlton' for your reply
Creating UDT's does make it more flexible if any changes are needed at a later date..
Do you then convert the RecipeStorage array in to a 1 dimensional array to then reference via a single screen on the HMI?
eg. Display a numeric input enable for the follow tags
RecipeStorage[0].Ingredient1
RecipeStorage[0].Ingredient2
RecipeStorage[0].Ingredient3...
Thanks again for your input