Tabbed Container Default View - Referencing Day of Week

Hi Retool Community - I am working with a tabbed container that consists of 7 tabs, each labeled for each day of the week. I would like to configure the container so that the view defaults to the tab that corresponds to the day of the week on which the user accesses it (ex. On Tuesday March 15, the default view of the container should be the tab ‘Tuesday’; the following day, it should default to Wednesday, etc.).

I see that the default view code is {{ self.viewKeys[0] }}; I am trying to incorporate getDay since it would refer to the day of week as a number, which I would think could be used to reference the view key but I just can’t figure it out; I am open to alternatives to getDay if a better solution can be recommended. Any solutions you can suggest would be greatly appreciated. Thank you!

Not too familiar with the new component set up but maybe Default Value is {{moment().format("dddd")}} and the Key is the same value so they are equal?

1 Like

Thank you @ScottR !! That works when:

  1. Add self.value = so full code is {{ self.value = moment().format("dddd") }}
  2. Switch the view keys to the full day name (instead of a numerical reference).

Thanks so much for the quick solution!

Glad to hear! Woot!