Forum Discussion
_anomDiebolt_
8 years agoQrew Elite
Here is some additional advice:
Here is a screenshot relevant to point 1 above (note the red highlighting):
This was just a partial cleanup and discovery of your formula. There are so many issues it becomes unclear what your formula is trying to accomplish.
Other than that use JavaScript whenever possible.
- use an editor such as Notepad++ which has a feature to highlight in red balanced parentheses
- place a space after every comma inyour formula
- use formula variables for (a) any repeated quantity and (b) any deeply nested quantity
- pay attention to case for variable types - eg use Number not number
- add extra lines to your formulas to seperate statements into groups - for example formula variables and the final returned quantity
- indent If() and Case() statements and use multiple lines . Don't write if() or case() as lowercase
- add comments after you have a working formula to help jog your memory when you return to edit the formula later. comments are just lines noise when you are creating your formula initially
- Never test if a Boolean is true (eg If([checkbox] = true, ...). Rather just write [checkbox]
- place a space on each side of operators (eg + , If([foo] = "bar", ...)
- place your formula or code within a pre tag so it shows up in the forum as monospace. This also allows my formula parser to harvest it automatically.
Here is a screenshot relevant to point 1 above (note the red highlighting):
This was just a partial cleanup and discovery of your formula. There are so many issues it becomes unclear what your formula is trying to accomplish.
Other than that use JavaScript whenever possible.
- RachelJones8 years agoQrew CadetThanks for the tips and formatting example. I already use some of these tips but not all. Particularly, I didn't know spaces were required after commas or that the variable type declaration was case-sensitive. Also didn't know the forum had the <pre> option. I will certainly use that in the future.
I understand that the logic of my formula is not evident from reading the formula itself, which is why I tried to describe it in text before pasting the formula. - _anomDiebolt_8 years agoQrew EliteThose are not required syntax rules but rather best practices ro make the formulas more readable.