How to comment your code or keep old expressions without executing them

I'm working on an old, large, undocumented, app that I've been asked to improve and evolve with some new functionalities. I'm treading carefully among the large number of slices and virtual columns, so in every part I'm touching I keep the existing formulas in place along with my new ones. This has been immensely beneficial. 

Since there's no #,  // or /* */ equivalent in AppSheet to keep some code in place without it being executed, I'm using this simple method to keep both codes in place.

I hope you find this useful. Happy AppSheeting! 

1. Replacing Code:

IF( TRUE,
  My new code ), 
  Old code )
)

2. Removing Code:

In case I just want to remove the existing code without replacing it with a new one. This would depend on the field:

2.1 Boolean Fields:

Like Valid If, Show?, etc.  I use this:

OR( TRUE,
  Old code )
)

2.2 All other fields:

IFS( FALSE,
  Old code )
)

2.3 Limitation - App Formula:

There is NO safe method to keep unused expressions in the App Formula field without replacing them with a new one. So while (1.  Replacing Code) is OK, (2. Removing Code) is not.

Therefore, I copy the old expression and put it in the Initial Value field instead, with some indication that this code used to be in App Formula. Like this:

IFS( FALSE,
  "*** The code below used to belong to App Formula ***" &
  Old code )
)

In case the Initial Value field already has some code, I use the first method, like this:

IF( TRUE,
  Working Initial Value expression ),
  "*** The code below used to belong to App Formula ***" &
  Old code )
)

Update - Here's a real-life example:

Capture dโ€™eฬcran 2022-05-20 aฬ€ 17.58.48.png

10 3 1,410
3 REPLIES 3

These are useful suggestions Joseph, in the absence of commenting the code that is not yet possible with AppSheet. Thank you.

Thanks my friend!

Here's a freshly-produced real-life example:

Capture dโ€™eฬcran 2022-05-20 aฬ€ 17.58.48.png

Top Labels in this Space