Hi!
I would like to find out if thereโs any way to sort month name according to month order (Jan, Feb, Mar, Apr, โฆ) instead of alphabetical order (Apr, Feb, Jan, Mar, โฆ)?
Thank you!
Solved! Go to Solution.
@App_Creator
If itโs not a big deal for you, slightly change your SWITCH expression:
SWITCH(
MONTH([Date]),
1, โ1-Janโ,
2, โ2-Febโ,
3, โ3-Marโ,
4, โ4-Aprโ,
5, โ5-Mayโ,
6, โ6-Junโ,
7, โ7-Julโ,
8, โ8-Augโ,
9, โ9-Sepโ,
10, โ10-Octโ,
11, โ11-Novโ,
โ12-Decโ
)
@App_Creator
May I ask where and how you are using that month names? And how you get them? With long date setting? Please elaborate.
Thanks LeventK.
I got the month names using switch expression and the names became Text. Hence sorting according to alphabetical order.
SWITCH(MONTH([Date]), 1, โJanโ, 2, โFebโ, 3, โMarโ, 4, โAprโ, 5, โMayโ, 6, โJunโ, 7, โJulโ, 8, โAugโ, 9, โSepโ, 10, โOctโ, 11, โNovโ, โDecโ)
I am using these month names to group a set of entries and sort in desending order according to the month in a table view.
Thank you!
@App_Creator
If itโs not a big deal for you, slightly change your SWITCH expression:
SWITCH(
MONTH([Date]),
1, โ1-Janโ,
2, โ2-Febโ,
3, โ3-Marโ,
4, โ4-Aprโ,
5, โ5-Mayโ,
6, โ6-Junโ,
7, โ7-Julโ,
8, โ8-Augโ,
9, โ9-Sepโ,
10, โ10-Octโ,
11, โ11-Novโ,
โ12-Decโ
)
Thatโs a great workaround! I will use that for the time being.
Thanks for your help, Leventk!
Youโre welcome @App_Creator, my pleasure. Great to be helped of.
Any idea why the results are formatted as timedate with this solution? The date column this expression refers to is formatted as a date column yet the results of the SWITCH expression are formatted as timedate?
@Michael
Thatโs basically because AppSheet interprets โ1-JANโ string as a short format Joda Date and appends 12:00:00AM to it and therefore evaluates the string as โ1st of January 12:00:00AMโ, โ2nd of February 12:00:00AMโ, โ3rd of March 12:00:00AMโ and so on. As @Aleksi mentioned check the type of your Virtual Column and change it to Text if not.
What happens if you change your column type to text?
Iโm still struggling with the idea that there has to be a way to display just the name of the month (without the preceding number and hyphen) and still have it sorted by month. Can anyone think of a way to โaliasโ a VC? Some sort of sort by โthisโ but display โthatโ? This is an old thread, has this been solved somewhere else?
โThisโ would be a Ref value and โthatโ would be its label.
Yeah. I was thinking that Ref might be the way to go but then if iโm using the label in any other view that will throw that off. Iโm still wrapping my head around all of the possibilities with Ref/Labels. Iโve probably overbuilt this particular table and am trying to do too much with it. Should build in more smaller Ref tables. Iโll keep at it and see what I can figure out. Thanks for the reply!
This is a perfect example of when a read-only table is appropriate.
[ID] is your key column, with 1-12.
[Month] is your text label column.
I do this exactly but for day of the week, and for the exact same reason.
The problem is Appsheet. There is a bug here. it simply does not recognize that you have set the column set to โtextโ when a Joda Date is present regardless of all we are doing.
I have been trying to solve this for years.
Huh?
Create a virtual column with Enum type and enum entries as month names in order โJanโ, โFebโ, โMarโ then use formula and switch statement to convert your date to month exactly like your enum. Then sort ascending and descending. It should work as expected.
Hi!
I was trying to solve that.
Your answer was simple, short and the Best Option
๐
Hi,
do you think i could solve my similar issue i'm having with this scenario ?
If yes, how ?
I've a table view that is grouped by Date 27/3/2023
I'd like to show Date in my native language (italian) as Lunedรฌ 27 marzo 2023
as i've done elsewhere (i.e. in detail views)
using 2 virtual tables VTGiornoSettimana and VTMese
CONCATENATE ([VTGiornoSettimana], " ", TEXT([DATA], "d"), " ", [VTMese], " ", TEXT([DATA], "yyyy"))
How to achieve the same result in Table view leaving the grouping by date but changing date with my italian string concatenation ?
User | Count |
---|---|
15 | |
14 | |
8 | |
7 | |
4 |