A somewhat of a documentation of hidden formulas [Added mechanics of nested buttons]

Seems like they patched it straight after your post…

That stuff went all a bit over my head since I wasn’t able to test it… I can certainly see the use for the async case, and that’d be great since the only way to run async actions is to manually click the buttons.

But then when you started adding delays, what are (were) the advantages of it over a simple RunActions?

The main advantage of using nested buttons (at least for me) was the ability to create more complex user interface. So that you can either click the big button for one action, or one of the smaller ones on it for a different one.

Example:
image

1 Like

Maybe it would help if you separate out the example in a shared document? The example you posted is still quite ambiguous.

1 Like

Actually, since I’m no longer going to work on this project using coda I’m going to share it whole.

And, in case anyone is interested in future development of this project, I’m going to post video entries about it on my youtube channel.

2 Likes

Using RegexExtract to implement a GroupBy() function: Group By using Hidden Formula RegexExtract

@Filmos @Dalmo_Mendonca @Paul_Danyliuk Anyone maybe know how to get the current URL (of the section displayed) through formula?

I’m trying to use it for filters so I can filter using the current page as context without having to hardcode it.

1 Like

I found a solution of how to get rid of the popup and render the actual control object, not a control object wrapped in an object. You still provide it wrapped to ParseJson(), but then use _Deref_Object() to extract the control object:

ParseJson('{"0":' + YourJson + '}')._Deref_Object("0")

I used this in my latest demo to insert text into Tasks table not wrapped but perfectly editable:

2 Likes

Did you ever solve this?

Regarding nice ways to prevent document crashing when using undocumented functions:

I thought I would attempt to come up with highly convenient way to prevent a crash, by first checking in the current year was prior to 1970 using Today().Year(), and if so, skip the offending code. In principle this works by simply changing the current year on your host O/S… however, I then discovered that Coda servers did not like this technique when dealing with offline documents as presumably it messes up some authentication or sync stuff.

So, I came up with using the current user’s time zone (via CurrentTimezone().CurrentOffset which works brilliantly.
Basically, my usual timezone offset is 0 or 1. So, before I execute any undocumented function, I check the timezone offset. If it’s > 1, then I skip the function. This way, I can simply modify the timezone on my host machine, open the doc and fix the error.

An alternative to this would be to create an artificial user (say ‘Debugger’) and check if the current user = Debugger. If so, skip the offending code.

Is the idea such that if the doc crashes, you could log in with Debugger and then fix the problem and restore the doc?

Yes.

The real crux of the problem is that if you use an unofficial function, you could crash your doc and end up in a perpetual state of never being about to fix it because it crashes when you open it.

The workaround is to ONLY execute the unofficial function under specific conditions, or to NOT execute them if a certain condition exists e.g based on the current user.

So you need an if() as a minimum at every instance of the hidden formula? Maybe declare a canvas variable with a short name and then if(x,code,"") - that the idea?

@Filmos Does this still work? I cannot get anything to work with the _Color( using the “kr-XXXXX”) format. I can get color to work with basic, “Red”, “Green”, “Blue”, etc. but all the rest of this with the -fg -bg, even if I copy, paste these formulas exactly, I cannot get anything but an error. Am I doing something wrong, or did this function change and make this no longer function?

3 Likes