FAQ: How to inject dynamic content into ScriptFollows-stuff?

MiServer is Dyalog's APL-based web development framework

FAQ: How to inject dynamic content into ScriptFollows-stuff?

Postby Michael|Dyalog on Fri Mar 10, 2017 3:43 pm

When working with the JS-Components, you will often come across "ScriptFollows" which is followed by many lines of static code. When following that style, the question come up how to make these scripts more dynamic.

When I want to add dynamic content into such a script, I use the Subst utility:
Code: Select all
MyData←...glorious calculations etc....
Add _.dimple('%ChartData%'MyData Subst ScriptFollows)
⍝...
⍝    myChart.data = %ChartData%
⍝...

Just be sure that MyData contains a correctly formatted JS-Array!

P.S: this post was created as a reply to a support-mail. We're trying to reply to questions of general interest (in an anonymized way) through the forums, so that everyone can benefit :-)
Michael|Dyalog
 
Posts: 12
Joined: Thu Mar 02, 2017 4:29 pm

Return to MiServer

Who is online

Users browsing this forum: No registered users and 1 guest