Gallery
How Kuovonne Codas
Share
Explore
Building Techniques

icon picker
Chunking formulas into functions

Thank Kuovonne for creating this content!
A key aspect of writing readable logic is chunking code into easy to understand and easy to reuse pieces. I like to think of these chunks like using paragraphs when writing an essay. When writing code in JavaScript, I would put those chunks in functions. However, the Coda formula language does not directly support functions. So I use buttons and named formulas to encapsulate the portions of logic that I think belong together.
Put these named functions and action buttons on one of the .
Use hidden controls as global variables to pass values from one button to another
Use one button per logical function. If you want to perform both A and B when the user clicks a button, create three buttons: one for A, one for B, and one that runs both A and B.
Use color and indent of the buttons to show how they are related.
Name all buttons on the code page, and have the label for the buttons match their names.
Put most of the logic in the buttons on the code page. Have visible pages push the buttons on the code page. Having the majority of the logic in one page makes it easier to write and troubleshoot the code.
ok
When writing and debugging action formulas on a backend code page, use Coda in multiple windows so that you can watch what happens to different tables and controls on the visible part of the doc.

Thank Kuovonne for creating this doc!


Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.