Forum Migration Notice
Update (2026-01-21): The user forums are now in read-only mode pending the data migration.
Update (2026-01-12): The user forums will be put into read-only mode on the 21st of January, 00:00 CET, to prepare for the data migration.
We're transitioning to a more modern community platform by beginning of next year. Learn about the upcoming changes and what to expect.
Update (2026-01-12): The user forums will be put into read-only mode on the 21st of January, 00:00 CET, to prepare for the data migration.
We're transitioning to a more modern community platform by beginning of next year. Learn about the upcoming changes and what to expect.
replace name with num value
andy_c
✭
Hi,
I have a slight problem, i have a randomGenerator witch gives me a number between 0 and 200. And i have 200 routines named "routine1, routine2" etc. And i want to do the rutin by random from the number i get from the randomGen. So to my question:
How do i replace the number 1 in routne1 with the value i get from my randomGen?
BR
0
Comments
-
you could make a routine that accepts your number and use test / case to run each of your individual routines..TEST RandonNumCASE 1 :Routine1;CASE 2:Routine2;ENDTESTlittle bit tedious.. but without know what your doing with the 200 routines i cant think of much better.0
-
Hello,You can use something called late binding to do this in a much simpler way. Please see the following example code:randomNumber :=GetRandomNumber;routineName := "Routine" + NumToStr(randomNumber, 0);%routineName%;This will call the routine with the name "Routine1" (if randomNumber is 1).Good luck!BR frpa0
-
HiYou can useCallByVar - Call a procedure by a variable
Example
reg1 := 2;CallByVar "proc", reg1;
Regards
Knud Erik Lindberg
Danrobotics0
Categories
- All Categories
- 5.7K RobotStudio
- 402 UpFeed
- 21 Tutorials
- 16 RobotApps
- 307 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 251 ScreenMaker
- 2.9K Robot Controller
- 368 IRC5
- 92 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 859 RAPID Programming
- 43 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 111 Collaborative Robots
- 5 Job listings

