Hello! I have clients which generate expenses and also pay me.
When a payment is added I want to SELECT FROM A LIST which expenses it’s cancelling and mark a CHECKBOX in the expense table.
I managed to get the multi-list working, but don’t know which formula to use to mark checkbox. I like the checkbox because I can check it even if no payment has been registered.
For the button Saldar :
I’m not sure if I’m gonna say this properly, but FormulaMap() (See here ) kind of run a formula for each elements in “a list”
In this case, the list is ThisRow.Movimientos and the formula is :
for each CurrentValue (of ThisRow.Movimientos (which are the Cliente from [Movimientos]) mark the checkbox Saldado as True()
For the Filter(), It compares the 2 lists Cliente and Clientes and get only the Cliente where Saldado is False()
But, having played around a lot with buttons and checkboxes, for some reasons unknown to me, I also had troubles with that and found the solution in this post :
No need for FormulaMap here. If you have a list of rows (in this case in Movimientos column), you can just feed that list to ModifyRows like this:
thisRow.Movimientos.ModifyRows(Saldado, true)
You generally only need FormulaMap if you need to calculate something based on CurrentValue. But in this case you just use a constant value true for each element of the list.
It is technically appropriate, just unnecessary here because ModifyRows already consumes a list of rows — no need to run an action for each row individually.
But generally you use FormulaMap when:
you need to transform a list of values into another list of values (e.g. take a list of “Firstname Lastname” strings and only extract the first name)
you need to run different actions/or with different parameters for each row (e.g. for each Domain row only add it to another table if it’s not there already — although that sounds like the check would be better done in a separate step in a Domains table button)
in an indexed loop idiom: Sequence(...).FormulaMap()
in some very complex formulas where performing the transformation in a separate column of the source table is not possible or makes less sense (e.g., when inside the FormulaMap one needs to use values from thisRow).
I can’t seem to make that one work
The buttons only work if there’s only a single row selected:
Edit: Got it. Some functions like Filter() return a table, so you can use it to convert a list of rows into an anonymous table before applying ModifyRows:
Still don’t know how your code would work for the original post, though.
I’ll get home and take a look. Although I think the column type could be a culprit there. It should be a lookup column with “Enable multi selection” enabled. Then in theory it should work (I don’t see why it wouldn’t)
UPD: Looked at your example. Hmmmmm Interesting to know that .Filter() intrinsically returns something different than a list of rows. Thanks for figuring out the .Filter(true) trick!
No, this is because nombre-completo is a lookup and a row reference, and email is just a string.
If nombre-completo row(s) are searched by given email, then what’s the problem? It’s logical: you pull in the rows that correspond to that email, then pass it to ModifyRows to edit.
Otherwise you can rewrite the above formula by: Integrantes.Filter(Email = thisRow.[tu-correo]).ModifyRows(...)