- Issue created by @gordon
- Status changed to Needs review
5 months ago 1:54pm 18 July 2024 - πΊπΈUnited States danflanagan8 St. Louis, US
Hi @gordon,
Under the hood, theequals
condition is super simple and adding anignore_case
option wouldn't be especially elegant, unfortunately.If using Migrate Conditions, the best options are to use
matches
, as you proposed, or to usein_array
like this:field_destination/value: plugin: if_condition source: source_value condition: plugin: in_array value: - yes - Yes do_get: constants/true else_get: constants/false
Though I would recommend using the
evaluate_condition
process plugin since it looks like you are setting a boolean.field_destination/value: plugin: evaluate_condition source: source_value condition: plugin: in_array value: - yes - Yes
or
field_destination/value: plugin: evaluate_condition source: source_value condition: plugin: matches regex: /^yes$/i
which could be simplified further by using parens notation to configure the condition:
field_destination/value: plugin: evaluate_condition source: source_value condition: matches(/^yes$/i)
If there's some quirk where you need to use
if_condition
, I'd also like to point out the relatively newdo_default_value
andelse_default_value
properties, which might help you avoid defining constants. See β¨ Add do_/else_default_value settings for if_condition Fixed .That all said, you could do this with the core
static_map
plugin as well. Something likefield_destination/value: plugin: static_map source: source_value map: Yes: TRUE yes: TRUE default_value: FALSE