# Getting data from XML database and updating textfields live (dynamic text)

**URL:** <https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824>\
**Category:** General\
**Created:** [May 14, 2019, 7:50am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824 "2019-05-14T07:50:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![adibub](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adibub](https://casparcgforum.org/u/adibub)\
**Post date:** [May 14, 2019, 7:50am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/1 "2019-05-14T07:50:54Z")

</div>

Hey guys, new here.

Have been looking at pushing data from a database to a .ft textfield and updating it live.

Is this at all possible do get live data through to caspercg and what frequency does casperccg support. Has anyone pushed the limits here?

Have seen some pointers to XML but not pushing out data live from lets say a client.

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [May 14, 2019, 8:08am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/2 "2019-05-14T08:08:37Z")

</div>

It is possible for sure. There are several ways of doing it. You can do a Flash template, that uses, for instance, a timer to pool the datasource. You could do a similar approach in HTML and JavaScript. Or you could write a custom client that updates the template from time to time.

Doing it directly in Flash/ActionScript or HTML/JavaScript is good, when you don‘t have a user interface for an operator. The second way, using a custom client is good, if you want the operator to see the data. I use this for clocks in sports, were the time is also shown in the UI.

What is your use case?

---

<div class="post-metadata">

**Author:** ![adibub](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adibub](https://casparcgforum.org/u/adibub)\
**Post date:** [May 14, 2019, 8:22am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/3 "2019-05-14T08:22:13Z")

</div>

Thx for the reply,

looking into e-sports. I also think the client way to do it would give me more options to what i want to do with the data. I can push it several places.

Any ideas on updaterate in caspar? Could i push data every 10 ms or 1 ms? Would this create a bottleneck?

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [May 14, 2019, 8:34am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/4 "2019-05-14T08:34:20Z")

</div>

I have only tried it with 1 second updates. Keep in mind, that the frame rate in Europe 25/50 corresponds to 40ms. Humans are able to see about 10 frames per second as different frames, so everything bellow 100ms is a waste of resources anyway.

---

<div class="post-metadata">

**Author:** ![adibub](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adibub](https://casparcgforum.org/u/adibub)\
**Post date:** [May 14, 2019, 8:58am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/5 "2019-05-14T08:58:35Z")

</div>

Indeed! was actually thinking about this yesterday, you dont need to push data to fast through.

---

<div class="post-metadata">

**Author:** ![adibub](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adibub](https://casparcgforum.org/u/adibub)\
**Post date:** [May 16, 2019, 9:40am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/6 "2019-05-16T09:40:53Z")

</div>

Testet the AMCP Clear command at 100ms intervals. Seems to run, are there any heartbeat solutions yet?

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [May 16, 2019, 9:59am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/7 "2019-05-16T09:59:08Z")

</div>

There is a [VERSION](https://github.com/CasparCG/help/wiki/AMCP-Protocol#version) command, that you can use for that. It gives back the servers version and as soon as the connection is lost, you get nothing back. I do live shows, that run many hours, without any heat beat, and never had any failure, as the server is very stable.

---

<div class="post-metadata">

**Author:** ![dangb9](https://casparcgforum.org/letter_avatar_proxy/v4/letter/d/59ef9b/32.png) [@dangb9](https://casparcgforum.org/u/dangb9)\
**Post date:** [May 18, 2019, 10:45am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/8 "2019-05-18T10:45:38Z")

</div>

Also the same here using the Update command once per second with no issues to a html template

---

<div class="post-metadata">

**Author:** ![adibub](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adibub](https://casparcgforum.org/u/adibub)\
**Post date:** [May 18, 2019, 11:02am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/9 "2019-05-18T11:02:44Z")

</div>

Yeah, i tried down to .1 sec and it worked fine. Without limitations in my .py script i got a overflow error. Reading in the sourcecode for the AMCP it says that exceeding 128 commands in the AMCP que and the overflow error is raised. In FPS games the amount of data is pretty big, have some concerns about raising the overflow error.  
I guess the CG UPDATE command must be sent for every dynamic text in the Template? Dont know if there are any workarounds here

---

<div class="post-metadata">

**Author:** ![dangb9](https://casparcgforum.org/letter_avatar_proxy/v4/letter/d/59ef9b/32.png) [@dangb9](https://casparcgforum.org/u/dangb9)\
**Post date:** [May 18, 2019, 11:40am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/10 "2019-05-18T11:40:57Z")

</div>

Well you can send all the textfield updates in one command (im sending about 60 - 80 data points per command) you could also look at nodeCG which I believe was built for use with OBS from E-sport point of view?

---

<div class="post-metadata">

**Author:** ![adibub](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adibub](https://casparcgforum.org/u/adibub)\
**Post date:** [May 18, 2019, 11:54am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/11 "2019-05-18T11:54:22Z")

</div>

Ohh, all in one long string then? Will check out nodeCG🙂

---

<div class="post-metadata">

**Author:** ![hreinnbeck](https://casparcgforum.org/user_avatar/casparcgforum.org/hreinnbeck/32/154_2.png) [@hreinnbeck](https://casparcgforum.org/u/hreinnbeck)\
**Post date:** [May 18, 2019, 12:16pm UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/12 "2019-05-18T12:16:14Z")

</div>

You should use websockets in the template itself for receiving the data.

---

<div class="post-metadata">

**Author:** ![dangb9](https://casparcgforum.org/letter_avatar_proxy/v4/letter/d/59ef9b/32.png) [@dangb9](https://casparcgforum.org/u/dangb9)\
**Post date:** [May 18, 2019, 12:23pm UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/13 "2019-05-18T12:23:52Z")

</div>

Yes so you send xml or json updates with each fieldname and value in one go

---

<div class="post-metadata">

**Author:** ![Jarda](https://casparcgforum.org/user_avatar/casparcgforum.org/jarda/32/1055_2.png) [@Jarda](https://casparcgforum.org/u/Jarda)\
**Post date:** [May 18, 2019, 5:50pm UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/14 "2019-05-18T17:50:52Z")

</div>

Could You explain how it is possible to communicate via websocket in the JavaScript please?

---

<div class="post-metadata">

**Author:** ![hreinnbeck](https://casparcgforum.org/user_avatar/casparcgforum.org/hreinnbeck/32/154_2.png) [@hreinnbeck](https://casparcgforum.org/u/hreinnbeck)\
**Post date:** [May 18, 2019, 6:04pm UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/15 "2019-05-18T18:04:08Z")

</div>

Tonnes of tutorials on websockets on the internet.

---

<div class="post-metadata">

**Author:** ![Jarda](https://casparcgforum.org/user_avatar/casparcgforum.org/jarda/32/1055_2.png) [@Jarda](https://casparcgforum.org/u/Jarda)\
**Post date:** [May 18, 2019, 6:45pm UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/16 "2019-05-18T18:45:45Z")

</div>

Aaah. I misunderstood…☹  
I though, that adibub needed to communicate between his (probably .NET) application as client and CasparCG server.

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [May 19, 2019, 10:12am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/17 "2019-05-19T10:12:48Z")

</div>

> [@Jarda](#):
>
> Aaah. I misunderstood…☹  
> I though, that adibub needed to communicate between his (probably .NET) application as client and CasparCG server.

There are always more than one way ro the destination. Queriing via websocket from inside a HTML template is one. Another can be to send an XML tree of data, via commands like CG LOAD, CG PLAY or CG UPDATE to a template. As I said elsewhere, it depends on the use case, what is the best way to go.

---

<div class="post-metadata">

**Author:** ![adibub](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adibub](https://casparcgforum.org/u/adibub)\
**Post date:** [May 19, 2019, 10:25am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/18 "2019-05-19T10:25:16Z")

</div>

The same goes for FLASH templates aswell using actionscript i guess?

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [May 19, 2019, 10:51am UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/19 "2019-05-19T10:51:37Z")

</div>

> [@adibub](#):
>
> The same goes for FLASH templates aswell using actionscript i guess?

Yes, there is a Socket object in ActionScript also. But, AFAIK, it‘s problematic to connect to websites, that are on other servers. I use it manly to control stuff on other Caspar layers, like playing background videos etc.

---

<div class="post-metadata">

**Author:** ![tomtailford](https://casparcgforum.org/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tomtailford](https://casparcgforum.org/u/tomtailford)\
**Post date:** [August 28, 2020, 3:04pm UTC](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824/20 "2020-08-28T15:04:02Z")

</div>

I’ve managed to make it this far - however I feel as if I’m getting a little out of depth (after reading a little of the NodeCG stuff)

Would you recommend someone who’s not got much experience at coding/HTML/Javascript to try and use NodeCG or websockets to get XML data into a template?

Thanks!

[Next page](https://casparcgforum.org/t/getting-data-from-xml-database-and-updating-textfields-live-dynamic-text/1824.md?page=2)
