Indirect Referencing of Record variables
Hi,
I'm creating a recipe structure, and I want to be able to assign values to a record element based on a user input. For example below, I made a simple Recipe data type, and I created 4 of them named "Part1"-"Part4". A user would select a button that would assign the string "Part1" into strHMISelect, and then I would use that string to reference the desired instance of the recipe data type.
Since strHMISelect now = "Part1", I want to be able to indirectly reference the Part1 recipe structure by using the string strHMISelect, reading something like "strHMIMessage.TravelDistance := 100"
OR, I could assign a value of "1" to a number register called nNumber for example, and then ask something like Part'nNumber'.TravelDistance := x.
Is there a clean way/possible way to do this?
For example:
RECORD Recipe
num TravelDistance;
ENDRECORD
PERS Recipe Part1;
PERS Recipe Part2;
PERS Recipe Part3;
PERS Recipe Part4;
PERS string strHMISelect;
PROC SetData()
strHMISelect := "Part1"
strHMISelect.TravelDistance := 100;
ENDPROC
I am also asking this because I need to figure out how to indirectly reference a tag in an HMI screen, so that when I switch recipes, the field for "Travel Distance" updates with the current setpoint for that recipe, if that makes sense.
Since strHMISelect now = "Part1", I want to be able to indirectly reference the Part1 recipe structure by using the string strHMISelect, reading something like "strHMIMessage.TravelDistance := 100"
OR, I could assign a value of "1" to a number register called nNumber for example, and then ask something like Part'nNumber'.TravelDistance := x.
Is there a clean way/possible way to do this?
For example:
RECORD Recipe
num TravelDistance;
ENDRECORD
PERS Recipe Part1;
PERS Recipe Part2;
PERS Recipe Part3;
PERS Recipe Part4;
PERS string strHMISelect;
PROC SetData()
strHMISelect := "Part1"
strHMISelect.TravelDistance := 100;
ENDPROC
I am also asking this because I need to figure out how to indirectly reference a tag in an HMI screen, so that when I switch recipes, the field for "Travel Distance" updates with the current setpoint for that recipe, if that makes sense.
0
Comments
-
Look into: - CallByVar: http://developercenter.robotstudio.com/BlobProxy/manuals/RapidIFDTechRefManual/doc12.html - GetDataVal: http://developercenter.robotstudio.com/BlobProxy/manuals/RapidIFDTechRefManual/doc52.html - Late Binding Proc Calls: http://developercenter.robotstudio.com/BlobProxy/manuals/RapidIFDTechRefManual/doc87.html0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings