Hi Alumio,
We have quite a few use-cases where we would really love a ‘global variable’ option.
For example, let’s say you have 2 ecommerce stores. One in Dutch, the other in French, and you’re getting the data from a PIM system which includes both languages.
Most of the transformers would be the same. In fact, maybe up to 99% of all steps would be exactly the same. For some things however, you’d have to switch the configuration up a bit. For example, getting mapping from Storage NL instead of Storage FR.
You could just set a field inside your data (“store”: “FR" or something), but in a complicated product-connection you’ll likely do more than a few node, transform nodes, maybe even some get branches, etc. Basically: you’d go “out of scope”, making it difficult to maintain that field inside your current scope.
A ‘global variable’ option would fix this. I’d imagine it like this:
- There’s a new transformer that’s called “Save to Global Variables” with a key & value option
- There’s either a new “Get from Global Variables” option, or a new JMESPath like structure to get it (i.e.
@{globals.current_store}
)
I’d imagine you’d need to put a maximum on the amount of data you can save with the ‘Save to Global Variables’ transformer, in case somebody tries to just save a few gigs of data into it.
This would also be very useful for some ‘loop-through’ use-cases. I.e. I sometimes have to loop through an order with a ‘calculator storage’ which divides the total amount over an x-amount of lines.