LB
9 months agoQrew Cadet
Change Logs
Hello, I'm attempting to create a change log to show the previous and new result changes from 3 tables into a "change log" table. I'm missing something with setting up the relationships I think and...
So is the setup this:
In the change log table you have for example:
[Field A Old], [Field A New], [Field B Old], [Field B New], etc?
and each time there is a change, the old an new are supposed to fill in, but if the old and new are the same value, only the new fills in? Is that the current issue?
Yes, that's how I have it set up, with old and new
and yes, that is the issue only the new is filling in and not the old value in addition
Someone else might have better ideas, but I can think of 2.
You could make a formula field for the Old in the change log, which says if Old=blank, then show new. That would be more of the reactive solution. The proactive one would be to use jinja to set the field.
I'm assuming the old field is set with {{a.$prev.fieldA}}
I am not great with jinja so hopefully someone else can jump in, but my notes show:
{{ CLEAR if a.date is none else a.date }} //To clear a date using condensed code
So perhaps for you: {{a.FieldA if a.$prev.FieldA is none else a.$prev.FieldA}}
I've never tried that but maybe it will work. Here are my other notes on if/then in jinja:
//Below is general if/else in Pipelines with jinja.
{% if some_condition %} {{do something }}
{% elif some_other_condition %} {{do something }}
{% else %} {{do something }}
{% endif %}
Example:
{% if a.date is none %} {{ CLEAR }}
{% else %} {{a.date}}
{% endif %}
Thank you, Mike. I was trying to find a low code/no code solution, similar to what I have already set up with the Pipeline and not going anymore complex than that.