Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Featured Replies

Hello,

As I am trying to expand my experiance, I'm trying to make calculations harder on myself so I can learn. Here is what I did with finding the month number from a Month Name:




Let (

list =  ValueListItems ( Get ( FileName ) ; "Month List" );



ValueCount ( Left (list ; Position ( list ; Month::SelectMonth ; 1 ; 1 ) + Length ( Month::SelectMonth ) ) )



)

SelectMonth Values:

January

Febraury

March

April

May

June

July

August

September

October

November

December

I didn't want to hardcode any months even though I could have used a simple Case function; what other ways are there to calculate a month number based on its name?

Thanks and God Bless!

David

I can think of several, but when you say you don't want to hardcode, it begs the question of language. You yourself have hardcoded the ENGLISH month names into a value list. What if the user is French?

Another question is the input method: in English, the first 3 letters of the month name are enough to identify the month. So if you limit yourself to English, you could use the same formula for short or full month name as the input, for example:

Let ( [

string = "janfebmaraprmayjunjulaugsepoctnovdec" ;

mmm = Left ( Input ; 3 )

] ;

Ceiling ( Position ( string ; mmm ; 1 ; 1 ) / 3 )

)

It wouldn't be too hard to compile a list of 12 month names in the current language, but I don't know the minimum length required to identify the month in each languages.

Hi

I know the you own FM8 and not the Advanced version, but isn't to difficult to ask someone to make a black file with this custom inside...

This custom function makes what you want and is *NOT* depending from the used language.

------------------------

/*

MonthNameToMonth custom function

Author: Daniele Raybaudi

Format: MonthNameToMonth ( theMonthName ; start )

Parameters:

theMonthName - text

start - number (must be set to 1)

Returns the month number of the given monthName

*/

Let([

date = Date ( start ; 1 ; 1 );

month = Month ( date )

];

Case(

start > 12 or IsEmpty ( theMonthName ) ; "?" ;

MonthName ( date ) = theMonthName ; month ;

MonthNameToMonth ( theMonthName ; start + 1 )

)

)

for example, the attached file is for ITALIAN's and you can try it with italian monthNames:

gennaio = 1

febbraio = 2

....

For use with English monthNames, simply make a clone of the file ! :

blankFile.zip

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.