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 231
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