Hello Appsheets Community,
I am looking to solve an issue we have. I need to Display MM/YYYY only for a date column as we don't have access to the day for the date desired. If I am able to make the user only select in this format as well that would be great.
Solved! Go to Solution.
In AppSheet, you can format the display of dates in the MM/YYYY format by using an expression in a virtual column. However, AppSheet does not support enforcing date input in a specific format directly in the date picker. Users will still use the standard date picker but you can format the date display as desired.
Hereโs how you can create a virtual column to display dates in MM/YYYY format:
1. **Add a Virtual Column:**
- Go to the Data section in the AppSheet editor.
- Select your table.
- Click on the โ+โ button to add a new column.
- Choose โVirtual Columnโ.
2. **Set the Column Formula:**
- In the formula box, use the following expression to format the date:
```plaintext
TEXT([YourDateColumn], "MM/YYYY")
```
Replace `[YourDateColumn]` with the actual name of your date column.
3. **Set the Display Name and Type:**
- Set the Display Name to something meaningful, e.g., "Month/Year".
- Set the type of the virtual column to "Text" since it's displaying the formatted date.
Here is an example of how you might set up the expression in the AppSheet editor:
- **Column Name:** `MonthYear`
- **Column Type:** `Text`
- **AppFormula:** `TEXT([Date], "MM/YYYY")`
This will create a new virtual column that displays the date in the MM/YYYY format. Users will still enter dates using the standard date picker, but this virtual column will display the date in the desired format.
If you need users to input only the month and year, a workaround is to use two separate columns (one for month and one for year) and then combine them for display purposes:
1. **Create Two New Columns:**
- `Month` (Type: Enum, with values 01, 02, ..., 12)
- `Year` (Type: Number)
2. **Create a Virtual Column to Combine Them:**
- Name: `MonthYear`
- Type: `Text`
- AppFormula: `TEXT([Month], "00") & "/" & TEXT([Year])`
This way, users select the month and enter the year separately, but you can display them together as MM/YYYY.
As per my understanding option to select only month and year is not possible with the calendar widget.
As a workaround, if there are just handful of months/ year combinations the user will need to select ( for example, the user does not need to select a month/ year in the past and in future also say he needs to select for say next 10 years max.) , then you could perhaps try with an enum that has valid_if being populated by a month year helper table. 10 years data entry will need 120 rows.
With two enums the options could reduce to just 10 for years and 12 for months, however the user may need to select two values which I believe will anyway happen in a calendar widget as well. Select year , followed by month.
An example below
In AppSheet, you can format the display of dates in the MM/YYYY format by using an expression in a virtual column. However, AppSheet does not support enforcing date input in a specific format directly in the date picker. Users will still use the standard date picker but you can format the date display as desired.
Hereโs how you can create a virtual column to display dates in MM/YYYY format:
1. **Add a Virtual Column:**
- Go to the Data section in the AppSheet editor.
- Select your table.
- Click on the โ+โ button to add a new column.
- Choose โVirtual Columnโ.
2. **Set the Column Formula:**
- In the formula box, use the following expression to format the date:
```plaintext
TEXT([YourDateColumn], "MM/YYYY")
```
Replace `[YourDateColumn]` with the actual name of your date column.
3. **Set the Display Name and Type:**
- Set the Display Name to something meaningful, e.g., "Month/Year".
- Set the type of the virtual column to "Text" since it's displaying the formatted date.
Here is an example of how you might set up the expression in the AppSheet editor:
- **Column Name:** `MonthYear`
- **Column Type:** `Text`
- **AppFormula:** `TEXT([Date], "MM/YYYY")`
This will create a new virtual column that displays the date in the MM/YYYY format. Users will still enter dates using the standard date picker, but this virtual column will display the date in the desired format.
If you need users to input only the month and year, a workaround is to use two separate columns (one for month and one for year) and then combine them for display purposes:
1. **Create Two New Columns:**
- `Month` (Type: Enum, with values 01, 02, ..., 12)
- `Year` (Type: Number)
2. **Create a Virtual Column to Combine Them:**
- Name: `MonthYear`
- Type: `Text`
- AppFormula: `TEXT([Month], "00") & "/" & TEXT([Year])`
This way, users select the month and enter the year separately, but you can display them together as MM/YYYY.
As per my understanding option to select only month and year is not possible with the calendar widget.
As a workaround, if there are just handful of months/ year combinations the user will need to select ( for example, the user does not need to select a month/ year in the past and in future also say he needs to select for say next 10 years max.) , then you could perhaps try with an enum that has valid_if being populated by a month year helper table. 10 years data entry will need 120 rows.
With two enums the options could reduce to just 10 for years and 12 for months, however the user may need to select two values which I believe will anyway happen in a calendar widget as well. Select year , followed by month.
An example below
This could work for us. Thank you!
You are welcome.
User | Count |
---|---|
17 | |
6 | |
6 | |
5 | |
3 |