Concurrent actions in 'Make a Thing'

I’m doing a ‘Make a Thing’ and updating 3 variables as shown in screenshot.

Q is whether these action occur one after another or happen at the same time.

What I’m seeing first time through is that the ‘total rating’ and ‘number of ratings’ is set but the ‘avg_rating’ (which uses the results of the first two) doesn’t provide a result the first time through (as if it the first two vars have not yet been set). The second time through, all seems ok but was wondering if the actions do not occur sequential w/i a workflow step. Thanks.

As you’ve discovered, the setting of the fields is not “one after the other.”

The way to think about this is that the expression values that go into your fields are evaluated immediately before the action is run. (Because that’s literally how it works internally.)

I haven’t seen that “Create if the thing doesn’t exist” checkbox in forever!

Yeah, what’s up with that shhhtuff?

so to be clear - you mean, all are evaluated before the entire action is run (thus none use a prior formula w/i a given action)?
Any suggestion on how to work around this?

Values go in as they go in.

Evaluated at inject time, see?

Write a plugin and examine. (It’s not hard, of course.)

But anyway, that’s how that works.


@davidm Let me translate @keith’s signature cryptic style :slight_smile:

These formulas will be evaluated prior to any changes are made in this action step. Okay, that’s it.

Now, how to make this work.

To ensure actions happen sequentially, simply add another workflow step and make it dependent on the previous step.

So if you want to calculate the avg_rating based on the updated ‘total rating’ & ‘number of ratings’, create another Make changes to a thing step and, instead of Thing to change being ‘Parent group’s Comment’, the Thing to change will be ‘Result of step 1’s Comment’.

Set your avg_rating field in this step.

As an aside, the way you are doing this will work but there are dynamic ways to track your ratings through a Rating thing that will eliminate the need for these values to be stored in the database and make your data substantially more powerful.

The forum has a host of information on setting this up if you are inclined to look at it.

1 Like

Are you saying a lot of information on how to track your ratings through a Rating thing?

If so, I’ll give a search for it.

Is it something you think the new feature of options would be useful for?

No, ratings will have to be created and stored in the database from the app interface.

The new Option set is designed as a static list variable that is set up inside the editor with the ability to access additional attributes for each option.

This topic was automatically closed after 70 days. New replies are no longer allowed.