# Creating a text string including variable value information?

**URL:** <https://forum.universal-robots.com/t/creating-a-text-string-including-variable-value-information/152>\
**Category:** URScript\
**Created:** [August 6, 2016, 3:07pm UTC](https://forum.universal-robots.com/t/creating-a-text-string-including-variable-value-information/152 "2016-08-06T15:07:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon43982785](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon43982785](https://forum.universal-robots.com/u/anon43982785)\
**Post date:** [August 6, 2016, 3:07pm UTC](https://forum.universal-robots.com/t/creating-a-text-string-including-variable-value-information/152/1 "2016-08-06T15:07:21Z")

</div>

In URScript is there a way to create a text string including variable value information? For example:

“Value var1 returned”

where var1 is a variable.

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [August 8, 2016, 6:33am UTC](https://forum.universal-robots.com/t/creating-a-text-string-including-variable-value-information/152/2 "2016-08-08T06:33:36Z")

</div>

Strings in URScript does not support concatenation or indexation.  
Hence, you cannot directly store a variable value in a string.

Consider using XML-RPC or other interfaces to perform this type of operations.  
A sample of XML-RPC calls for concat is found under [samples](http://forum.universal-robots.com/c/urcaps-plugins/samples).

You can also write a concatenated string to the UR logfile using the script function `textmsg()`

---

<div class="post-metadata">

**Author:** ![anon43982785](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon43982785](https://forum.universal-robots.com/u/anon43982785)\
**Post date:** [August 8, 2016, 3:02pm UTC](https://forum.universal-robots.com/t/creating-a-text-string-including-variable-value-information/152/3 "2016-08-08T15:02:28Z")

</div>

Cute! I never thought of that.

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [August 11, 2016, 7:19pm UTC](https://forum.universal-robots.com/t/creating-a-text-string-including-variable-value-information/152/4 "2016-08-11T19:19:06Z")

</div>

Here is a little nodejs server that we wrote with a conactenation function. We actually have an URScript API that we have written for interacting between the robot and our cloud connector, we are working on moving all of that functionality to an XML-RPC server so that it is easier to maintain over time versus keeping up a URScript API library.

```
var xmlrpc = require('xmlrpc')
var _ = require('lodash')
var PORT = 6968
var serverOptions = {
  host:"192.168.1.105",
  port: PORT
}

// Creates an XML-RPC server to listen to XML-RPC method calls
var server = xmlrpc.createServer(serverOptions)
// Handle methods not found
server.on('NotFound', function(method, params) {
  console.log('Method ' + method + ' does not exist');
})

server.on('concatenate', function(err, params, callback){
  var returnValue = ""
  _.forEach(params, function(value) {
    returnValue += " " + value
  });
  callback(null, returnValue)
})
console.log('XML-RPC server listening on port 9091')
```

---

<div class="post-metadata">

**Author:** ![anon43982785](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon43982785](https://forum.universal-robots.com/u/anon43982785)\
**Post date:** [August 12, 2016, 12:48pm UTC](https://forum.universal-robots.com/t/creating-a-text-string-including-variable-value-information/152/5 "2016-08-12T12:48:36Z")

</div>

@mbush @jbm  
Thanks. I’m new to xml-rpc but am quickly discovering the power -have been throwing more and more functionality into the server we’ve started to interface our vision software with UR.
