WithName behaviour

Im running this code

WithName(
  Slack::PostMessage([Buddy Organizer], "jojo","email@email.com"),
  CalendarResult,
  RunActions(
    ModifyRows(
      thisRow,
      [Next buddy events].[Calender result],
      CalendarResult
    ),
    thisTable
      .Filter(
        CurrentValue.Buddy = thisRow.User
      )
      .ModifyRows(
        thisTable.[Calender result], CalendarResult
      )
  )
)

You can replace the slack message with a calendre event creation from google.
What I expect to happen is that I shall create one calender event, and take that result and modify two rowns with the result.

But what acctually happens, is that the external action is run before each modify row action, meaning two events are created. That is unfortunate.

What am i missing in the docs, or what am I doing wrong?

I don’t remember the exact thread where this was discussed (@jeo to the rescue? :slight_smile: ) but this is known.

Actions don’t really return the resulting values — they return PendingEvaluation objects (similar to JS Promises but not really) and it’s other actions such as ModifyRows that unwrap data from those promises to insert into cells. That’s why when you store an action into a variable with WithName, you store NOT the result of running the action but the call-to-action itself. That’s why whenever you use CalendarResult further in your formula, it runs the action every time.

The workaround would be to not use WithName but store the result somewhere to a cell and then use the result, i.e.

RunActions(
  thisRow.ModifyRows(CalendarResult, Slack::...),
  thisTable.Filter(...).ModifyRows(..., thisRow.CalendarResult)
)
5 Likes

@Paul_Danyliuk , your knowledge iof the Coda internals is impressive. you have put in many hours of forensic experimentation to get this deep-voodo knowledge

but…

shouldnt all these details be in the documentation, or in a deep-dive tutorial by coda?

and shouldnt coda support folks be the ones answering these questions on this forum?

don’t misunderstand me… this community is GREAT and the ‘community champions’ are the real HEROES.

buy coda users, however smart and tricksy, cant be expected to know EVERYTHING. and it’s not unreasonable to expect coda to DOCUMENT how their product works.

are any codans taking notes? for an upcoming overhaul of the documentation? or a developers-special deep-dive podcast?

now…

how can i exploit this new-found nugget of knowledge about the ‘late binding’ trick in WithName() ??? :wink:

respect
max

3 Likes

hi @Agile_Dynamics ,

Many, many times I wondered why Coda employees did not intervene and not even take the time to write proper documentation. A possible reason could be that what we do with Coda is out of the ordinary for 80 - 90% of their users and clients. In business terms it might not be so relevant and urgent as it is for ‘us’ the heavy users.

The focus today is on productivity tools (rituals) and while the makers program aims to find new ways to enter various verticals, new users may not be attracted by complexity.

I love to be corrected with any good argument. So please if I am mistaken, just drop a note!

Cheers, Christiaan

3 Likes

Coda folks are busy developing the actual product :slight_smile: and their support gets tons of messages through Intercom etc. already. The champions program is both a privilege and responsibility — we get some nice perks (a sponsored workspace, access to internal Slack and a direct line to most of the Codans) but also have to keep being active in the Community and help whenever we can. Basically we’re like support but no payroll and we can advocate using hacks :smiley:

On the documentation side, I don’t think documenting everything should be a goal. As Christiaan just said, a use case like this could be something most of the regular users will never discover. And documenting each such behavior could only do harm and scare them off: they’ll perceive Coda as a complicated beast and may give up on learning it. Meanwhile pro users will find this anyway — go to the community, search, ask directly, watch my videos :grin: and so on.

5 Likes

@Paul_Danyliuk
@Christiaan_Huizer

i appreciate what you both say, and i am extremely happy with what coda can do and the rate at which codns are improving the product!

and i really appreciate the sterling work of the community champions :slight_smile:

and i must admit to enjoying this adventure of finding out the hidden gems and secret knowledge along this quest

but many of my clients work in regulated industries, such as aerospace, clinical research and financial services. so i am used to extremely stringent expectations re documentation. it becomes a habit, i guess.

but, as you point out, 90% of use cases are well covered by existing documentation…

so…

i just have to keep reading the posts and watching the videos

max

1 Like

Thanks for a quick reply! And great work on the community championing! You should have had some tokens for your effort :stuck_out_tongue: They call it stocks in the real world I guess :stuck_out_tongue:

Yeah, what I did was to store it to a cell, and then copy paste it to the other cell that needed it. Since it was not a strict flow and could work that way.

But I do support that the docs should specify that it returns a new action rather than the result, because I needed to test this to make sense of it. And that is why I would call it a bug than anything else. I dont feel like a super user, but im a programmer and just push the boundaries and expect things to work

1 Like

Paul reported this behavior to the Codans in December 2020 :point_down:

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.