GetData and Setdata for recipe

GetData and Setdata for recipe
none 0.0 0
  • HMI Model: cMT2078X (Simulation)
  • EasyBuilder Pro Version: 6.10.01.259

I have the recipes set up with several stages with a numeric change at the end of the tag name. I want to make this easily adjustable and show one step group at a time. I’ve tried two options.

One is a Macro. which lead to asking if the GetData/SetData statically set?

GetData(ProcStep, “Local HMI”, RECIPE, “PROCESS.StepType1”)

Works fine. However, if I try and create a string for PROCESS.StepType to go through the series (1,2,3…10) it refuses it and won’t compile.

Option 2 Templates:
I tried a template, but it absolutely ignores the Recipe memory space (doesn’t seem to acknowledge it as a valid variable).

Hi @grodberg,

Could you please elaborate on what you mean by “I have the recipes set up with several stages with a numeric change at the end of the tag name. I want to make this easily adjustable and show one step group at a time.”

Also, could you send a screenshot of your macro and the error messages you are receiving?

The value from the GetData function from your example will be for the currently selected recipe record. The recipe record can be selected from within a Recipe View object or the recipe database’s “Selection” system register.

My recipes are made up up several steps, for example
StepType1 to StepType10
Power1 to Power10
Time1 to Time10
Temp1 to Temp10
etc.

I’m using a Recipe View on a screen to select a recipe. Let’s see if this screen shot attaches.

I cannot attach files for some reason, but here’s some of the code

short LastStep = 0

short ProcStepReq
short ProcStep
float Power
int Time
float Temp
short Aux
int Limit
float Holdback

short ProcStep2
float Power2
int Time2
float Temp2
short Aux2
int Limit2
float Holdback2


short G_StepType
short G_HoldbackType
bool G_EndType

macro_command main()
//Pulls data from recipe selection segment to edit/view area
char PartName[20]
char s_steptype[20] = "PROCESS.StepType"
char s_power[20] = "PROCESS.Power"
char s_time[20] = "PROCESS.Time"
char s_temp[20] = "PROCESS.Temp"
char s_aux[20] = "PROCESS.Aux"
char s_limit[20] ="PROCESS.Limit"
char s_index[2]

bool DataEnable = 0
short S_Subpage_Req = 0

GetData(PartName[0], "Local HMI", RECIPE, "PROCESS.PartName")
GetData(ProcStepReq, "Local HMI", "Recipe_Edit_Index", 1)
GetData(LastStep, "Local HMI", "Recipe_Edit_Index_Last", 1)

//Pull Data as a CASE list as Recipe does not support arrays
if (ProcStepReq > 0) and (ProcStepReq < 11) then
	DataEnable = 1
	S_Subpage_Req = 1
	DEC2ASCII(ProcStepReq, s_index[0], 2)
	StringCat(s_index[0], s_steptype[0])
	StringCat(s_index[0], s_power[0])
	StringCat(s_index[0], s_time[0])
	StringCat(s_index[0], s_temp[0])
	StringCat(s_index[0], s_aux[0])
	StringCat(s_index[0], s_limit[0])

end if

SetData(DataEnable, "Local HMI", "R_LOCK_SELECT", 1)
SetData(S_Subpage_Req, "Local HMI", "R_PageSelect", 1)

if (DataEnable > 0) then
		GetData(PartName[0], "Local HMI", RECIPE, "PROCESS.PartName")
		GetData(ProcStep, "Local HMI", RECIPE, s_steptype[0])
		GetData(Power, "Local HMI", RECIPE, s_power[0])
		GetData(Time, "Local HMI", RECIPE, s_time[0])
		GetData(Temp, "Local HMI", RECIPE, s_temp[0])
		GetData(Aux, "Local HMI", RECIPE, s_aux[0])
		GetData(Limit, "Local HMI", RECIPE, s_limit[0])
//Push Data
end if
end macro_command

We only access 1 step at a time to create a simpler screen.

I’m trying to build a string so I don’t need a giant CASE array to access all variations and to make modifications easier. However, I get a syntax error (C1) and a device address error (C45) when I attempt to use a string as the target of GetData or SetData.

Hi @grodberg,

Thanks for sharing your macro.

As shown in the example below, using a string as an address is not supported.

You could potentially enable the recipe item value transfer option, and transfer those values to registers within the local HMI. This can be enabled in the Transfer tab in the Recipe database.

To execute the transfer, the appropriate value will need to be entered in the Recipe Database command register.

Then, use a macro similar to the one below.