Recognize a change in data

Fairly simple question.

There is a list with data
Each time something in the list changes
The autoput boolean should ‘very shortly’ change to true
(in other words, when a change is recognized change → true, hereafter change to false again).

Something like the python script does a is shown in the forum shown below, with the modification that it works with changes in text. (not only with changes in numbers).

Any suggestions?



This code should works.


1 Like

… meh

Please argumentate further.

@bbalbastre interpreted your question as per-row of you list of texts… is that correct?
Or you want a global true/false testing it as a whole single block of text?

Also explain your context, what you ask is a sort of bool “impulse” going through your algorithm (correct?)… while it is not impossible or hard to achieve so (with some simple script), you might want to discuss why you are needing this.

Like this:
check string changes
check string (6.9 KB)


  private void RunScript(string txt, ref object changed)
    if(stored == null || !String.Equals(txt, stored)){
      stored = txt;
      changed = true;
      changed = false;

  // <Custom additional code> 
  string stored;

This gives a single Boolean value if any data has changed:



But here’s a case where it fails:

1 Like

Thank for you quick reply!

It does what I asked for :slight_smile: .

However, as you are right I should explain the context a bit more.
Here you will see it is part of a bigger challenge.

I will try to explain it as simple as possible.
Although it is a quite fundamental/generic challenge.

General purpose:
Make a script as lean as possible: by only ‘handeling’ data which is changed or added, instead of ‘handeling’ All data, all the time.

Example En-DE

e.g. imagine there is a cluster which translates words from english to german.

  • There is an input list, containing english words.
  • The words go into cluster where they will be ‘Translated’
  • The output is a list of ‘German’ words.

so far so good.

However, imagine that the input list is changed (for whatever reason), . e.g. 1 word is replaced by another word.

In normal GH scripts, what would happen is that again ‘All’ words go into the cluster and are translated.

Note: in this example the list of inputs is very short and the ‘translation/action’ is very simple, but imagine that the list is very long and the translation/data maniputaion is more complex, it can become time consuming very fast.

So my suggestion is as follows:


  1. Save/Record the original output

  2. Isolate/recognize the input item(s) which have changed/or have been added.

  3. Delete all input(s) which have been there before (but keep the recordings of these translations).

  4. Only ‘Translate’ the remainer items (=items which have not been there before).

  5. Get the original output (A) and delete all outputs which are no longer applicable.
    (e.g. van be seen by the index nr).

  6. Combine the remainer of the ‘original’ output list with the ‘new’ output list.
    Note: words have to be located on the correct list index.

2022-11-09 Translate only words which have been (15.1 KB)

Any suggestions to solve (parts) of this?

Many thanks!

I meant to get back to this yesterday but forgot about it.
data_change_2022_Nov9b (5.8 KB)

It’s also easy to compare CRC values from Python:

import binascii
a = binascii.crc32(x)

1- we treat each row independently, then. Correct?
2- Your translate module is a plugin? It would be simpler to treat this all inside a script (where it can remember old state) … maybe with nodeincode …
3- if you have a list of 1000 strings, and you insert a string at the start of the list, the script is going to recaulculate everything anyway… because every element is changed (while in reality it just moved)… maybe storing every possible EN>DE pair is simpler…


Thanks again :slight_smile:

  1. Yes is correct.
  2. No its a cluster with alot of geometrical manipulations.
  3. The input data is just plain text (not very heavy), the only thing is, is that the cluster is quite slow… the more input the slower it becomes. So I am trying to reduce the input to the minimum possible…

Just let me know if you have any suggestions!

Thanks again!:+1:

The input is a text string, and the output is a text string… and you are doing geometrical manipulations :sweat_smile:? “Translation” … ?

Ok, I have no idea of what you are doing.

I can put up something, but I will work blindly…
Is the input just a simple text and the final output a simple text?

1 Like

Haha I can understand. :sweat_smile:

But in fact what is happening in the cluster is not really relevant.

Would just like to feed the cluster with only modified or added text :slight_smile:

Try this:

translation (16.0 KB)

Update (re-internalize) the dictionary every time a new word come out.
This is needed to avoid recursive data stream.
We can automatize this, but do some tests first.

1 Like


Yep the concept works!
Would you be able to automate this? :slight_smile:

Thanks again!


Thanks again, while playing around with it, I ran into one thing.
If an items is only slightly changed (e.g. → cat → cats) the original translation of ‘cat’ is still showing.
This while it should be replaced by the catS translation.

Thaks again very much, If you have any idea just let me know!

It is meant to work this way.
The right c# component only receive new words to store in the dictionary.
The “this old translation is wrong, replace it with this new translation” is a concept you never mentioned.

“cats” and “cat” are two different words, with two different translations.
The dictionary store both translations correctly.

If you want to destroy and build a new dictionary use the reset button.

Thanks for the quick reply :slight_smile:

You are right, I didn’t mention it earlier. (it would be nice if it works but if its a lot of work its fine).

Would it be possible to automate the update (re-internilize) the dictionary every time a new word comes out as mentioned in your earlier reply? :hugs:
This is the most important for me at this time :slight_smile:

Thanks again!

I don’t understand how you imagined it to work.
Please explain how you imagine the “remove/replace that word from the dictionary”.
As before, cats and cat might be words you want to keep. Both.

About the automatization, i’ll see later.

Thanks again!

Let me explain in a bit more detail.

Only the input items which are present in the input, have to be presented in the 'output '. (in other words: input and outputs should always contain the same ‘items’)

See below a few consequtive inputs, and what the actions & results should be:

First input is shown at 1. → 2 → 3 etc.

If there are any more questions, just let me know!


It is already working that way.

In this picture:

if you update the dictionary by internalizing you’ll have what you want in the “Translated texts” panel.

You must update the dictionary all the times, until the component outputs an orange wire.

Hmm, then I think I am doing something wrong, :see_no_evil:
anny suggestions?


Don’t look at the right panel, delete it.