Recipe View Selection

Recipe View Selection
none 0.0 0
  • HMI Model: cmt-fhdx-820
  • EasyBuilder Pro Version:6.10

Need to select multiple rows within Recipe View and Transfer them to another recipe. How can this be achieved?

Hi @outbound6,

Thank you for contributing to our forum.

For the first part, it is not possible to select multiple rows within our recipe view object.

To transfer data between recipes, we would recommend using a macro to transfer the data. Below is a link to a our forum post to search for and filter items within a recipe view object. You can use this to get and set data within a macro to transfer data.

Please try and let me know if you have any follow up questions.

How can i transfer data from a SQL query from a database server to a Recipe Database. Please let me know if you have example code or method.

Hi @outbound6 ,

Below is one of our tutorials on the SQL Query Object. Around the 12-minute mark, it shows how to pull data from your database and place it in a local register. To save your data to a Recipe object, select “Recipe” in the Output tab, then choose the appropriate field for the data.

Please let me know if you have any questions.

SQL Query Object Video

I’m not successful at this…

If i command the query (execute) and point the output to given recipe the data isn’t showing up in the recipe results object. (Data shows up in SQL query results viewer) I also don’t know what happens to your query results if it has multiple rows of data, in this case i fell as if i should be turning on the option for multiple rows but the option isn’t available to output to a recipe.

Sorry for all the questions…

Hi @outbound6 ,

Its all good, thank you for the questions, we appreciate them!

After consulting with a colleague a better solution would be to get the data from the SQL Query object. Place it into LW memory, RW if you require more space, then use a macro to transfer that data into the recipe database.

To get the data into LW memory please go to your SQL query, in advanced mode, and within the Read command select Multiple results within the output tab. Also ensure the bulk address is a free within your project and causes no memory overlap.

Now that we have the data on the HMI memory we will use a macro to:

  1. Execute the read from SQL to local memory by placing a 1 in the control address of the SQL query.
  2. Clearing out the recipe by placing a 4 in the recipe command
  3. Then looping through all results within for loop that will grab the data from local memory and place into recipe memory.

macro_command main()
	short read = 2, add = 1, delete_all = 4
	short key = 0, value_1 = 0, value_2 = 0
	char value_3[10] = {0,0,0,0,0,0,0,0,0,0}
	
	// Read from SQL and output to LW
	SetData(read, "Local HMI", LW, 7000, 1)
	
	// A delay to import data from SQL
	DELAY(60000)
	
	// Clear recipe
	SetData(delete_all, "Local HMI", RECIPE, "Recipe.Command")
	
	// Now we can move data into recipe
	short i = 0
	for i = 0 to 499
		GetData(key, "Local HMI", LW, 0 + i * 8, 1)
		GetData(value_1, "Local HMI", LW, 1 + i * 8, 1)
		GetData(value_2, "Local HMI", LW, 2 + i * 8, 1)
		GetData(value_3[0], "Local HMI", LW, 3 + i * 8, 10)
		
		DELAY(10)
		SetData(key, "Local HMI", RECIPE, "Recipe.Key")
		SetData(value_1, "Local HMI", RECIPE, "Recipe.Value_1")
		SetData(value_2, "Local HMI", RECIPE, "Recipe.Value_2")
		SetData(value_3[0], "Local HMI", RECIPE, "Recipe.Value_3")
		
		DELAY(50)
		SetData(add, "Local HMI", RECIPE, "Recipe.Command")
	next
	
end macro_command

Below is a link to the demo projects we used for you to reference. Please let us know if you run into any question.

Thank you!

I think i need a little macro help.. I don’t believe i have the getdata correctly…

Codetop -. ascii @ 20 words

CodeBottom → ascii @ 20 words

Bitting1 → ascii @ 20 words

Bitting2 → ascii @ 20 words

Keyalike, ringqty, binqty all 32-bit unsigned

GetData(CodeTop[0], “Local HMI”, EM1, 0 + i * 8, 40)
GetData(CodeBottom[0], “Local HMI”, EM1, 1 + i * 8, 40)
GetData(Bitting1[0], “Local HMI”, EM1, 2 + i * 8, 40)
GetData(Bitting2[0], “Local HMI”, EM1, 3 + i * 8, 40)
GetData(KeyAlike, “Local HMI”, EM1, 4 + i * 8, 1)
GetData(RingQty, “Local HMI”, EM1, 5 + i * 8, 1)
GetData(BinQty, “Local HMI”, EM1, 6 + i * 8, 1)

Hi @outbound6 ,

Could you please share the serial number of your HMI for our reference?

From the macro, it looks like you’ve placed your data in EM memory. Could you confirm this and also share your SQL Query + SQL Query Command setup so we can further investigate?

Furthermore, below is a forum post on converting protocol and transferring data that is useful in setting up your macro.

Thank you!

SN: 2505105248

It’s odd because i have a few of these unit and some have the MicroSD and some do not…

@outbound6,

Earlier this year the cMT-FHDX-820 was upgraded to include a micro SD slot. Due to this upgrade, the SD option available within EasyBuilder Pro will not apply to some older units.

OK…

Need to know the best way to copy one recipe to another recipe.

Would it be another macro or is there a data transfer that can be ran?

Hi @outbound6 ,

If you just want to transfer the value from one recipe address to another, you can use a combo button like in the image below on the two addresses you want to interact with.
First, set up a data transfer between the two recipe databases and their addresses.
Then set a delay before placing a value of 1 into the recipe command register of the recipe database that is receiving the data.

A Data Transfer object can also be used to do the same and can be found within the Object tab.

Please let me know if this works and if you have any questions.

Thank you!

Data Transfer in combo button setup

Set word within combo button to place a value of 1 into the command register of a recipe

all available values of a recipe object.

Thanks, but i need all the data from one recipe to another. What you provided just copies first row count, unless i misunderstood.

Hi @outbound6 ,

Apologies I misunderstood your last question.

For a full transfer from one recipe to another we would recommend using a macro. In the post below, within the advanced section it shows how to access all the values from a recipe database. Instead of setting the values within a LW register, you add it to the receiving recipe database.

Please let me know if you have any follow u questions.