Help with nested loops and the new WithName() formula

Hi @Breno_Nunes ,
basically you are asking the button - in plain english:

Hey, would you please create a new row in the Item table for every entry that is selected in the Orders table

The key here is for every and the only way to instruct the processor to do that is through FormulaMap().

The WithName() function only allows to, well, give a name to an expression.

I have the feeling you might have interpreted the RunActions() as an implicit FormulaMap()
For every row of my dataset do…”.
As a matter of fact, RunActions() allows just to group sequentially different actions; for this reason, here is redundant (but working)

So let’s dissect the formula:

Orders.Filter(Unarchive) // let's take the selected orders
    .FormulaMap( // for each Order record we have
    CurrentValue.WithName(ChosenOrder, // give it the name ChosenOrder and...
    Item.AddRow( // add a new row on Item table
        Item.[Order Number],ChosenOrder.[Order Number] // with the values taken from the current ChosenOrder
)))

In this case you should need to have a record reference (such as First() or Nth() or Last()) in order to execute an action on that record.

Please, tell me otherwise.
Cheers!

9 Likes