How to delete value from a list of values using a button?

… And avoid having blank values in the list as a result, like this:
image

I explain in detail in this doc.

Thanks in advance, I can’t figure this out…

Hi @Fran_Vidicek

Here is my suggestion, I created separated column for better understanding

First I check which value of current rows must be deleted according to your wish. For example in Item 1 we dont care about Folder 1, cause folder 1 doest not belong to parent folder for item 1.

Then, we calculate what will stay after the completion of the macro

Please mind here the final .IsBlank().Not() that will remove the undesired blank value in the generated sublist

Make a Master Button to replace each “parent folder” column to “what stays” values


CPT2212201329-1003x837

Let me know if this is OK for you

Quentin

2 Likes

I’ve been watching at the formulas for a few minutes now…
Woah, :exploding_head:. Still trying to wrap my head around it…

So far seems like exactly what I was looking for though!

1 Like

Ahah thanks @Fran_Vidicek
Let me try to translate it in english :slight_smile:

  • Column “To Delete From Parent Folds” : please coda, check one by one all parents folder value in this currents Row. Once you’ve got first value, verify if this value is ticked in Folder database as “selected”. If Yes, write this value (I want to delete it !), otherwise make a blank value". Please do that for every value in Parent folder. When you’re done, please delete blank value, i do not need them ! Now, I’ve got value to be deleted from the Parent Folder, according to selected value in Folder database

  • Column What Stays : please coda, check one by one all parents folder value in this currents Row. Once you’ve got first value, Check if this value is not in the column “To Delete From Parent Folds”, if it is not, that means that I want to keep it, so please keep it. Do that for every parent folder. And at the end, please delete blank value, I do not need them.

  • Master Button : Please coda run through every row in items database, for each row i’d like to replace the column Parent Folder to the column “What Stays” :wink:

Hope this is more clear :wink:

2 Likes

That makes is very easy to understand.

I have another question… or two… :thinking:

  1. Is it possible to achive this without the use of extra columns?

  2. The only reason I am asking this is because of performance: Will having extra columns have any effect on performance of my doc?

I would have a view of the Items table where these columns wouldn’t be shown anyway, but does it affect the performance regardless of if they are visible or not? Keep in mind, there might be 2000+ rows.


In other words: If I have a table with 2000+ rows and 30 different columns but I also have a view of that same table in a different page that shows only 4 of those columns.

Do those invisible 26 columns have negative performance effect on the doc speed?

Hmmm, I need to have a look on that. But as a master button including all formula will require to have 2 or 3 several ForEach() function, I usually dont even try doing this (As Far As I Know this is impossible to perform multiple foreach, refering to current value 1, current value 2, etc… which is a pity). May be better coda master than me will know if there is an efficient way to do that.

Honestly, I havent work with more than 2000+ rows, and as long as I hide my column, I do not see any performance issue. but this is people depending I understand.

Let me have a look on a master button and keep in touch

1 Like

@Fran_Vidicek

Ahah… :smiley:

ForEach(
  Items,
  ModifyRows(
    CurrentValue, [Parent folders], 
    ForEach(
  CurrentValue.[Parent folders],
  SwitchIf(
    ForEach(
  CurrentValue,
  If(
    Folders.Filter(Selected).Contains(CurrentValue) = True(),
    CurrentValue,
    ""
  )
)
  .Filter(
    CurrentValue.IsBlank().Not()
  ).Contains(CurrentValue).Not(),
    CurrentValue
  )
)
  .Filter(
    CurrentValue.IsBlank().Not()
  )
  )
)

Check “Ultimate Button” in my doc :wink:

CPT2212201525-1159x790

1 Like

if you want to nest ForEach() loops and yet have access to the currentValues for each outer loop, you must use the WithName() function to name them.

so your outter and inner loops might be

MyCustomers.ForEach(CurrentValue.WithName(thisCust,
    thisCust.Orders.ForEach(CurrentValue.WithName(thisOrd,

now you can refer to thisCust for the current customer and thisOrd for the current order, etc…

max

2 Likes

:confetti_ball::tada:Thanks a ton!!!:partying_face::tada:

I’m too tired right now, and by just glancing at the formula my brain is resisting to look at it (it’s complex).
I will look at it when I get rested tomorrow, but just wanted to say thanks for the help.

ForEach() and WithName() formulas are quite advanced for me so combining them will be interesting challenge to comprehend.

But this code below doesn’t have closing parenthesis so I’m assuming it’s not finished? :thinking:

1 Like

Thanks @Xyzor_Max :slight_smile:
I usually don’t use with name cause I see my gorilla without it, but in this case this is a real and valuable addition !