Set Value - Server Connect

Hello everyone,

I have researched the forum about the Set Value server action but still have some questions.
I’m using node.js, ok?

I need to store in a variable the last value I used to update a table in the database. But I have some repeats and conditional and maybe it’s a scope issue. Will try to explain:

Is this the correct way to work with SetValue action? Maybe my logic is not right?
Tried to change names and keeping the global name and didn´t work.

Any help is very appreciated!

Hi Otavio.

The value stored in var_last_date is going to be updated on every repeat. Setting the global name earlier means the value will be available within the repeat but the value will still be updated on every cycle.

This is a good thread if you’ve not already seen it: Set value - Name and Global Name values discussion

Does that help at all? I’m not convinced I’ve answered your question!

Cheers, Jon.

always help, @sitestreet! Thanks!

How to keep the value and not update on every repeat?

I would create another variable (Set Value var_last_date2 for example) and maybe use a condition to update that variable with the value from var_last_date whenever you need to.

1 Like

Will try! thanks mate!

1 Like

@sitestreet! got it!!

Added a new variable before the new cycle! Working great! thanks for the tip!

Would be awesome have a SetValue really acting as variable. is this possible @george?

1 Like

It already does. You set it to whatever you want and can decide whether the value is output or not. And it appears in the data picker just like everything else.

hummm…but variables can store/keep its value on a repeat (with the logic I used), for example, right?

The value is kept until you set it again which is how a variable works. I think you were struggling because you were setting the value every time the loop was processed.