Button to create rows for the next month

Ah, now I got it…
You need two nested loops: one for the groups, one for the dates:
(Obviously, you need the Group column, as well).


Sequence(1,2).formulaMap(currentValue.withName(group,
  Sequence([Start Date],[End Date]).FormulaMap(currentValue.WithName(date, 
      [Table].AddRow(
        Date, date.ToDate(),
        Group, group
        )
      )
    )
  )
)

Try this and let me know

1 Like

Group names are text like this:
Audi A8 long
Porsche Panamera S
BMW 5 series

More items can be added or may be removed.

In that case, having a them in a table Groups would help automating the row generation:

Groups.formulaMap(currentValue.withName(group,
  Sequence([Start Date],[End Date]).FormulaMap(currentValue.WithName(date, 
      [Table].AddRow(
        Date, date.ToDate(),
        Group, group
        )
      )
    )
  )
)

And the Group column in your table would be a lookup on Groups

1 Like

I’m sorry. I can’t figure out what “withName” does.
@Federico.Stefanato Can you see where the error is?

1 Like

WithName() allows you to assign a name to an expression.
So, in that case, date and group hold the single value of the iteration (in order to avoid currentValue override in nested the loops, like this one).

I fixed your button: now it should work.

Let me know if this is the desired outcome.
Cheers!

1 Like

Hi @Federico.Stefanato :handshake:

You have helped me a lot and not for the first time!
Thank you very much! Special thanks for the quick responses!!!
Now I understand how “withName” works.

Tweaked it a bit to add a condition:

140 firefox

141 firefox

1 Like