Preventing an app formula / InitialValue firing when a row is copied

Hi,

Please could someone advise if it possible to prevent an app formula and or an InitialValue firing when a row is copied?

I have a VC app formula called max_branch_number that looks for the MAX “branch number” in three columns of the survey table:

MAX(
survey[branch_number]+
survey[branch_A_number]+
survey[branch_B_number]
)

The survey form has two app formulas that say [max_branch_number]+n to give me the next available branch number:

IF(
[branch_A_decision] = “Yes”,
([max_branch_number]+1),[branch_A_number]
)

IF(
[branch_B_decision] = “Yes”,
([max_branch_number]+2),[branch_B_number]
)

An on-form-save action then creates n copies of the form.

Each time the row is copied, the formula fires again and the numbers change.

I’d like just the values to show in the copied rows so that they have the same “branch number” as the ‘parent’ row.

The final twist is that, while rows are being added, the parent row calculations are correct. After the last row is created the action visits the first row again and the formula fires once more and I end up with changed numbers!

Is my issue related to how I’m creating my additional rows?

Grouped action for on-form-save

Action for first row:

Action for last row:

Thanks in advance for any pointers…

Cheers…

Solved Solved
0 6 228
1 ACCEPTED SOLUTION

You could add an extra column for auto generated rows and add an if condition based on that column to prevent the formula from firing.

View solution in original post

6 REPLIES 6

Bummer. Do you need to manually create new rows or could you perhaps make this an exclusive auto generated table?

Hi @Bellave_Jayaram… Thanks for coming in… I’m not familiar with auto generated tables… I’ll look them up… Don’t need to create rows manually… Just need them created ASAP after form save…

This sounds interesting… Please could you elaborate a little…?

You could add an extra column for auto generated rows and add an if condition based on that column to prevent the formula from firing.

Hi @Bellave_Jayaram,

Thank you very much for that suggestion! Works beautifully!

Here’s what I did:

  • moved the app formula into InitialValue
  • created an extra column called [do_not_fire]
  • added the text “Stop” to [do_not_fire] via the AddRow actions
  • amended the expressions to the following:

IF(
[do_not_fire] = “Stop”,[max_branch_number]-1,
IF(
[branch_A_decision] = “Yes”,
([max_branch_number]+1),[branch_A_number]
))

IF(
[do_not_fire] = “Stop”,[max_branch_number],
IF(
[branch_B_decision] = “Yes”,
([max_branch_number]+2),[branch_B_number]
))

Thanks for nudging me in that direction…

- always glad to know one’s suggestion worked. You have a very cool app you are working on, btw.

Thank you… It’s been a very interesting project and AppSheet and the community seem to have an answer for every challenge I’ve come up against so far! I’m very impressed! Cheers…

Top Labels in this Space