Is this by design, feature lacking or bug?
<script is="dmx-flow" id="flow1" type="text/dmx-flow" autorun="autorun">{
assign: {
value: "{{translation.data.Send}}{{browser.userAgent}}",
name: "title",
output: true
}
}</script>
Is this by design, feature lacking or bug?
<script is="dmx-flow" id="flow1" type="text/dmx-flow" autorun="autorun">{
assign: {
value: "{{translation.data.Send}}{{browser.userAgent}}",
name: "title",
output: true
}
}</script>
You are having a timing issue.
The flow runs directly, while the JSON data source has to fetch its source, so its data comes in later. And by then your flow is already done.
I presume at least that you have the flow ran automatically.
If you really want to use the JSON data - then add the flow run method on the success event of the JSON data source - then you know for sure that data is loaded.
Thanks. I was trying to actually do that manually as I didn’t think of the JSON data source with SC events. But yeah. There it is
I will try later. Pretty sure it will do the trick.
@george it worked like a charm. Now I just need to achieve this when the json is being loaded in a php SSI.
The json file is loaded and on success event I run an inline flow to set a global variable.
<dmx-json-datasource id="trans" is="dmx-serverconnect" dmx-bind:url="../../assets/locales/{{locale}}/{{appName}}.json" dmx-on:success="run({setGlobal:{key:'translation',value:'loaded'}})"></dmx-json-datasource>
Now it would be great to run a flow from any page when translation has value loaded.
For this I have created a variable that reads the global and runs when it’s updated.
<dmx-value id="var1" dmx-on:updated="flow1.run()" dmx-bind:value="{{translation}}"></dmx-value>
Is this the best approach? I don’t feel very comfortable having such poor control and just running when the variable is updated(with any value).
Would like to have something like when {{translation}} == loaded run the flow by following this approach or other.
Ideally it would be directly from the json success event, but as it’s contained in a SSI it won’t do the trick.