Temporary target values are not known to tampers.

Created on 1 May 2023, over 2 years ago

Problem/Motivation

My guess is this is obvious but hoping just a simple bug that can be overcome as it offers a lot of power if this worked as the UI suggests.

I am trying to write a new tamper plugin as a simple conditional tamper.

I want to set source X value to either field A or field B based on source Y value.

- Source Y has 4 values, 2 have me write X to A, 2 have it go to B.
- i Copy Y to Temporary target M
- i rewrite the 4 options to either 0 or 1

I then wrote a new plugin which writes NULL based on if source field is 0 or 1. But this tamper needs to know the value written to my tmp target but it does not know this value.

I was confused as the built in Copy tamper includes a list of to/from fields and includes the tmp ones as well. But i tested and it also does not work to copy from a tmp target.

Since it does list fields that it says are supported to copy, at the very least this is bug report in that it should not list tmp target fields; but hoping this is fixable as my conditional tamper relies on this working.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada liquidcms

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @liquidcms
  • 🇳🇱Netherlands megachriz

    This sounds like an UX issue in Feeds Tamper, so moving it to that project.

    The way Feeds Tamper currently works:

    1. It sorts all Tamper plugins by weight.
    2. Then it loops through all Tampers and groups them by source field.
    3. It loops through all source fields with Tamper plugins.
    4. Per source field, it applies all Tamper plugins for that source field.

    So I think that the issue is is that the tampers for source 'Y' are handled later than those for source 'X'. This means that when Feeds Tamper applies tampers for source 'X', the value for the temporary target is not yet available.

    A short term solution would be to set the weight of the first Tamper plugin for source 'Y' to a lower value than for source 'X'.

    A long term solution would be to redesign the Feeds Tamper UI, so it becomes clear which source is taken care of first. Even better would be to change the processing logic so that tampers are not executed strictly per source in sequence. Instead, tampers from different sources could be interleaved according to their weights, allowing you to apply a tamper to source X, then one to source Y, and then another to source X within the same run. But that change has more impact and could cause BC breaks.

    By the way, sorry for the very late reply. I'm walking through the bug reports for Tamper to see what should be fixed for a stable release.

Production build 0.71.5 2024