Forum Academy Marketplace Showcase Pricing Features

Do every 0.1 seconds?

I need an elements custom state to be constantly updating.

If I set a workflow to run every 0.1 seconds, does that mean I’m using 10 workflows each second the app is running?

Pretty much. That sounds relatively too taxing on the client’s device. What are your requirements such that it is necessary for you to update at such a frequency?

I have a text that represents a clients price, which is based on the sum of several dropdowns. It’s likely the client will select different items from each dropdown, so the price will be changing constantly.

A better thing would be “When an input is updated”

The text could just be the sum of the values of the dropdowns. The total should be calculated instantaneously; if not, do what @codurly suggested. In your case, there is no need to trigger a workflow every 100 milliseconds.

Thanks for the suggestions. Unfortunately, I’ll run into other problems if I do that (I think).

The text that represents the sum of the dropdowns is actually a subtotal. The subtotal’s value is used to calculate the total. The problem is that text elements do not have values, so I can’t target the subtotal to calculate the total. I could set a custom state to reflect the subtotals value but I’ll run into the same problem; the custom state will have to update constantly, so I’ll have to use the “When an inputs value changes” workflow … however, that workflow can’t target text elements.

Since the “Run every 0.1 seconds” isn’t a sustainable option, I’ve thought about adding input elements to reflect the calculated values and simply make the invisible. Just seems like a messy/hacky solution.

Why not store the data in a group and have the text element reference it’s parent element, namely the group?

Store the data in a group through a custom state? That would definitely work.

I assume the main difference between this solution and my hidden input solution is the fact that I won’t have to have hidden elements, correct? Or is there a difference I’m not noticing?

I was referring to the group storing the data, not as a custom state, but the custom state should work too. Overall, I don’t think running a time based workflow is necessary. It would work the device more than it needs to. Give any of the suggested solutions a shot and report back if you hit a snag.

So I’ve added an Input element with ‘initial content’ set to “Dropdown 1’s value + dropdown 2’s value” . I have a workflow set to “When Input’s value is changed” > Set custom state to Input’s value".

I would expect that to work, but when I preview the page to test it, I notice that the Input’s custom state always reads “empty” when I inspect it. The value is clearly changing, so why doesn’t that trigger my workflow?

EDIT: Were you suggesting I set a group’s data source to the sum of the dropdowns? Because I just tried that, and it seems to work for what I’m trying. I had completely overlooked that aspect.