Your favourite little-known Anvil feature?

Anvil is a pretty big platform, and it’s easy to miss things. Prompted by this thread, I wanted to ask:

What’s your favourite Anvil feature that others might not know about?

What parts should be better known? What should we be shouting louder about? What part of Anvil do you want to tell people about because it saved you hours of work, and might do the same for them?

Answers on a postcard in this thread, please!

2 Likes

For me, that has to be Portable Classes. Those have saved me having to write very similar create, read, update and delete server functions for every class I want in my apps.

2 Likes

Using Ctrl+Click (or Cmd+Click on Mac) to navigate to methods, even anvil.server.call("") methods from client code.

The automatic serialization of Anvil Data Table objects from server to client and back. Once the Data Table row is received within Server Code, assigning values to it from there are automatically saved! I think this is more obvious now from newer documentation, but I didn’t know about this at first and it would have saved me time if I knew about it.

Also if I’d used @anvil.tables.in_transaction as a server method decorator more often, I would have saved myself some bugs.

4 Likes

Some people enjoy politely preventing user interaction while a process runs by using a with statement and a Notification:

with Notification("Please wait..."):
  # ... do something slow ...

https://anvil.works/docs/client/python/alerts-and-notifications#notifications

2 Likes

This is exciting to learn. I’d say shout about this a bit. Is it currently documented anywhere?

1 Like

… Is it currently documented anywhere?

Not that I could find in 30 seconds of searching. IIRC I saw it from another forum post of a preview feature. Not sure if it’s a temporary feature, or just hasn’t been formally documented.

I will also advocate for the rest of the implemented keyboard shortcuts though that I love having in a web code editor.

2 Likes

Only place I could find mention of it was this May 2018 blog post: Anvil News - May

1 Like

Oh! Can we get a horray for the query operators?! :clap:

I use them all the time when working with DataTables.

5 Likes

How about this one, a huge facepalm for me :man_facepalming:

Anvil is described as ‘Drag-and-drop’, however for most things you can click and drop! (click then drop)

It seems minor but I feel like I have been doing it wrong this whole time!

5 Likes

Here’s one :

Not so much my favourite, more I had no idea it even existed. Was this ever announced?

EDIT - not only was it announced here : New: anvil.js.window but I even “liked” it.

Is that a light at the end of the tunnel or the head mounted torch of a doctor in the loony bin?

4 Likes