Just getting started on AppSheet and landed a...

(Padman Kondur) #1

Just getting started on AppSheet and landed a issue that should have an answer.

I have a simple form where I want to capture the pay period (that has ENUM values for each month - Jan, Feb, … Dec).

Now I want the field to have a default value corresponding to the current month.

So if the form is entered on 5/1/2018, the payPeriod field should default to “May”.

When the entry is made on 4/30/2018, the payPeriod field should default to “Apr”.

I tried using TEXT(MONTH(), “Mmm”) which is the Google Spreadsheet function.

Didnt work in AppSheet.

I tried using SWITCH(MONTH(), “Jan”, “Feb”,… “Dec”) that didnt work

Any suggestions?

(Aleksi Alkio) #2

Correct format is… SWITCH(MONTH([DateColumn]), 1,“Jan”, 2,“Feb”, … 11,“Nov”, “Dec”)

(David Ackling-Jones) #3

In the initial value property try Month(Today()) Which will give you the month as a number by default. To give it to you in “Mmm” format you might have to do a nested IF statement.

(Padman Kondur) #4

A combination of both your responses worked.

Here is the solution:

=SWITCH(MONTH(TODAY()), 1, “Jan”, 2, “Feb”, 3, “Mar”, 4, “Apr”, 5, “May”, 6, “Jun”, 7, “Jul”, 8, “Aug”, 9, “Sep”, 10, “Oct”, 11, “Nov”, “Dec”)

Thanks.

(David Ackling-Jones) #5

Cool! I now know about SWITCH expressions. Thanks @Padman_Kondur and

@Aleksi_Alkio.

(Cando Mayorga) #6

El problema con esta expresión es que cuando ordenas por meses, lo hace empezando por abril y no por enero Translate

(Padman Kondur) #7

Seems there are many bugs.

At least one i can identify is with SWITCH.

Doesn’t look like it can take more than 5 values.

The following works if I have months up to “May”.

As soon I add “Jun”, it gives error.