How to delete a specific value from a list?

No problem @Fran_Vidicek :grin: !

I’m very glad to know you were able to make it work :raised_hands: !

It was the very first thing I tried before saying that I was getting back :innocent:
(as it seemed like a shorter and easy way to get to a possible solution)

I’ll admit that this thought crossed my mind but I wasn’t sure you would need it (and I then got distracted IRL and forgot to test this as well… Sorry about that :sweat: ) .

So, just for completeness (in case someone else would need something similar), here’s a button allowing you to remove multiple erroneous currencies for a country (See [Submit edits - 2] in the sample) :blush:

The workflow is :

  1. Click on the Edit Country button in the table Country for the country having erroneous currencies tied to it.
    The button will add a row in the helper table below
  2. In the helper table, select the currencies you want to remove for the selected country (leaving out the correct one)
  3. Click on Submit ([Submit edits - 2] or [Submit edits - 3])

The whole Action Formula in [Submit edits - 2] is :

Currencies.Filter(
  Currency.Contains(thisRow.[Select currencies - The ones to remove].Currency)
  ).ForEach(
    RunActions(
      ModifyRows(
        CurrentValue,
        Country,
        Splice(
          CurrentValue.Country,
          CurrentValue.Country.Find(thisRow.[Country being edited]),
          1
        )
      )
    )
  )

And similarly to my previous reply, what it does is :

Step 1 : Filter()

Currencies.Filter(
  Currency.Contains(thisRow.[Select currencies - The ones to remove].Currency)
  )
[...]

So we take the table Currencies and we ask the filter to look for and keep the rows where CurrentValue.Currency contains the Currency of thisRow.[Select currencies - The ones to remove] (i.e.: the erroneous currencies)

This returns a list of rows from the table Currencies

Now that we have the appropriate list of rows, the Step 2 is :

[...].ForEach(
    RunActions(
      ModifyRows(
        CurrentValue,
        Country,
        Splice(
          CurrentValue.Country,
          CurrentValue.Country.Find(thisRow.[Country being edited]),
          1
        )
      )
    )
  )

… For each row returned by the filter and stored within CurrentValue, ModifyRows() :

  • The row to modify is CurrentValue

  • The column is CurrentValue.Country
    I.e.: The field Country in the table Currencies for that specific row

  • The columnValue is the spliced list of Countries for that specific row

    Splice() :

    • The value is CurrentValue.Country
      I.e.: The current list of countries in the field Country in the table Currencies for that specific row ( stored within CurrentValue)

    • the start is CurrentValue.Country.Find(thisRow.[Country being edited])
      I.e.: The position of thisRow.[Country being edited] in the current list of countries for that specific row

    • the deleteCount is still 1
      (For 1 currency in thisRow.[Select currencies - The ones to remove] we remove 1 country from thisRow.[Country being edited], 1 by 1 in this case )

And the button [Submit edits - 3] still uses the fields next to it to get to the same result :blush:

1 Like