# Put actual routine name in a variable

**URL:** <https://tech-community.robotics.abb.com/t/put-actual-routine-name-in-a-variable/6451>\
**Category:** RobotStudio\
**Created:** [January 13, 2015, 6:15pm UTC](https://tech-community.robotics.abb.com/t/put-actual-routine-name-in-a-variable/6451 "2015-01-13T18:15:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EliteRobotique](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@EliteRobotique](https://tech-community.robotics.abb.com/u/EliteRobotique)\
**Post date:** [January 13, 2015, 6:15pm UTC](https://tech-community.robotics.abb.com/t/put-actual-routine-name-in-a-variable/6451/1 "2015-01-13T18:15:17Z")

</div>

Hi ! I want to have the actual routine name in a string variable. Does it is possible, if yes how ?

Thanks

---

<div class="post-metadata">

**Author:** ![ko414du4](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@ko414du4](https://tech-community.robotics.abb.com/u/ko414du4)\
**Post date:** [January 14, 2015, 8:58am UTC](https://tech-community.robotics.abb.com/t/put-actual-routine-name-in-a-variable/6451/2 "2015-01-14T08:58:47Z")

</div>

What do you need the actual routine name for? Is it for some sort of logging purposes?

---

<div class="post-metadata">

**Author:** ![PerSvensson](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/persvensson/32/1040_2.png) [@PerSvensson](https://tech-community.robotics.abb.com/u/PerSvensson)\
**Post date:** [January 14, 2015, 10:23pm UTC](https://tech-community.robotics.abb.com/t/put-actual-routine-name-in-a-variable/6451/3 "2015-01-14T22:23:34Z")

</div>

If the purpose is to call a routine by a string here is an example

MODULE module1

VAR string routine:=“Hello”;

PROC main()  
CallByVar routine,1;  
CallByVar routine,2;  
ENDPROC

PROC Hello1()  
TPWrite “Hello 1”;  
ENDPROC

PROC Hello2()  
TPWrite “Hello 2”;  
ENDPROC  
ENDMODULE

---

<div class="post-metadata">

**Author:** ![EliteRobotique](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@EliteRobotique](https://tech-community.robotics.abb.com/u/EliteRobotique)\
**Post date:** [January 10, 2018, 8:17pm UTC](https://tech-community.robotics.abb.com/t/put-actual-routine-name-in-a-variable/6451/4 "2018-01-10T20:17:33Z")

</div>

I was for logging. I wanted an universal routine for dataloging. I did’nt find how to retreive the actual routine name but I used a Pers variable with my routine name for the CallByVar and I call a Datalog routine with the same variable as a parameter. It work well except if i manually launch a routine, in need to pass by the main routine to be sure that the call is do.

Thanks

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [January 10, 2018, 9:21pm UTC](https://tech-community.robotics.abb.com/t/put-actual-routine-name-in-a-variable/6451/5 "2018-01-10T21:21:36Z")

</div>

Call by variable with a string looks like: %Hello1%; You might be able to concatenate that: %Hello% + NumtoStr(1,0);

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [January 11, 2018, 9:24pm UTC](https://tech-community.robotics.abb.com/t/put-actual-routine-name-in-a-variable/6451/6 "2018-01-11T21:24:40Z")

</div>

This might be more correct for the second option: %Hello + NumToStr(1,0)%;
