Button Click Counter

Hi.
Is it possible to create a button click counter?
I would like to record the growth of my cow pasture.
For this I go over the pasture and measure the growth every 25 steps and have to count the measured value (3cm, 4cm, 5cm, etc.) and calculate the average at the end (sum of cm / number of measurements). I want to record the measured values through the corresponding buttons.

Hi, I’m not sure if I understood your case correctly, but I find it very interesting. Would you also post a screenshot of your table? Do you record each measurement in a column or in a row?

Hi Karlheinz.
I record the measurements in columns because in the rows are following measures at other days.


Because i can only put 1 media into a post here the further formulas:

3cm Summe = {3cm Anzahl}*3

Aufwuchs = ({3cm Summe}+{4cm Summe}+{5cm Summe}+{6cm Summe})/({4cm Anzahl}+{5cm Anzahl}+{6cm Anzahl})

Here is the beginning of the table, more cm are still missing.
The subtotals will be hidden.
In {Anzahl} Columns i need the button click counter.
These counters i want in a webform.

I see. So you can do this by writing a script. I have written the following example script:

const table = base.getActiveTable();
const row = base.context.currentRow;
base.modifyRow(table, row, {'3cm Anzahl':row['3cm Anzahl']+1});

And set the button to run this script. So when you click on this button, the number in the ‘3cm Anzahl’ will increse by 1:

count

1 Like

Hi.
thanks. The script and the button works great.
Now is the problem, the buttons do not appear in the webform.
i need the buttons near together so that they all have space among themselves on the mobile

That’s right - the buttons are not shown on the form, which is a pity. But we’ll list this as a feature request.

For now:
You can move the columns together so that the buttons are together, and you can rename the buttons so that you know what each button does.

Like this, for example:

What is even better, is a row details page (just tap on the two-directional arrow sign at the beginning of a row to open it):

1 Like

For the script of the buttons to work, 0 must be entered as the default value in the “Anzahl” columns.
If I now leave only the button columns visible for the mobile input, the default value is not set and the error message #value appears. Reordering columns and leaving them visible solves the problem.
That with the row detail page was a good tip.