SetControlValue() for List

Hey guys, I am trying to use a FormulaMap() to SetControlValue() for a list, but SetControlValue() does not understand a CurrentValue as a Control, is there a way to do that?

hi @Guilherme_Salles

something like:

SetControlValue("name control",thevalue.Nth(currentvalue) ))

the number 10 is obviously the count of the list you are working on.
does this help?
cheers, Christiaan


Not sure, actually. Looks like your solution is for looping for one Control, right? What I am trying to do is to create a Button that reset many many controls to Blank (“”) value. My formula inside the button today is:

RunActions (
SetControlValue(“control number 1”, “”),
SetControlValue(“control number 2”, “”),
SetControlValue(“control number 3”, “”),
… and more

Not sure if I was more clear now.

Yeah I thought it would work if they were in a list (either defined in your formula, or in a named formula elsewhere in the doc), but I see the same thing where they don’t reference the control (instead they just reference the control’s value).

E.g. this doesn’t work

  [Control number 1],
  [Control number 2],
  [Control number 3]
  SetControlValue(currentValue, "")

If you have a list of controls like that (presumably all with similar properties and related purpose) why not use a table instead? Then you can FormulaMap over the table and ModifyRows.

this is indeed a different use case, but I don’t see the problem you want to solve. This works (your example):

you can replace the SetControlValue() with ResetControlValue(), it is shorter and does only one thing, but still no need for a FormulaMap()

Coda has no function that states: give me a list of all my controllers in this doc and reset them.

cheers, Christiaan

I second @Ryan_Martens2 here, what I’d do is make a table for these inputs, not separate controls.

There are hidden formulas to access controls dynamically in a formula but I wouldn’t recommend it.

I am trying to find the fastest way to do this “cleaning”. I was trying to use FormulaMap() to see if it does that faster. @Paul_Danyliuk not sure If a table would be a better solution since the project needs to be mobile friendly.

hi @Guilherme_Salles , if you have one button that contains all the ResetControl functions, you (or a bot) presses the button once a day (or at night) and off you go. The button does not need a FormulaMap() to run. Your suggestion behind the question in my opinion is that it would be nice to have a kind of master function to reset all controllers (or a sub set of all). However this is not what we have today.; cheers, Christiaan

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.