Hi,
Is there any function to convert the month in text to number?
For example convert FEB to 02, Jan to 01 and so on.
Thanks,
Solved! Go to Solution.
Good question. My answer is to use a workaround, but I will be happy if somebody else points to a funtion so I can use it in my own projects.
My suggested workaround is to build your own Array of Months:
Initialize variable
Name: MonthsArray
Type: Array
Value: [{Month: "JAN",Index: "01"},...,{Month: "DEC",Index: "12"}]
Now let's assume the month expression you want to translate is stored in a variable called 'currentInputMonth':
Filter Array
Input: variables('MonthsArray')
Filter equals(item()?['Month'],variables('currentInputMonth')
Now let's assume you want to store the result in a variable called 'currentOutputMonth'
Initialize variable
Name: currentOutputMonth
Type: string
Value: if(equals(length(body('Filter_array')),1),first(body('Filter_array'))?['Index'],'ERROR')
Proud to be a Flownaut!
Hi @adri3
Try the following:
formatDateTime('01-Feb-2010','MM')
You can insert the value that you want in the place of the "Feb" based on the field that you want. The day and year are irrelevant. It's just to get a valid date.
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
โ
Cheers
Manuel
Good question. My answer is to use a workaround, but I will be happy if somebody else points to a funtion so I can use it in my own projects.
My suggested workaround is to build your own Array of Months:
Initialize variable
Name: MonthsArray
Type: Array
Value: [{Month: "JAN",Index: "01"},...,{Month: "DEC",Index: "12"}]
Now let's assume the month expression you want to translate is stored in a variable called 'currentInputMonth':
Filter Array
Input: variables('MonthsArray')
Filter equals(item()?['Month'],variables('currentInputMonth')
Now let's assume you want to store the result in a variable called 'currentOutputMonth'
Initialize variable
Name: currentOutputMonth
Type: string
Value: if(equals(length(body('Filter_array')),1),first(body('Filter_array'))?['Index'],'ERROR')
Proud to be a Flownaut!
Hi @adri3
Try the following:
formatDateTime('01-Feb-2010','MM')
You can insert the value that you want in the place of the "Feb" based on the field that you want. The day and year are irrelevant. It's just to get a valid date.
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
โ
Cheers
Manuel
Brilliant. Thank you. Just what I was looking for
@manuelstgomes Much more elegant than mine. Thanx for sharing!
Proud to be a Flownaut!
Hello,
I use this one which works also :
Text(DateValue("January 2021"),"[$-en-US]m")
Join digitally, March 2โ4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.
User | Count |
---|---|
33 | |
16 | |
15 | |
12 | |
9 |
User | Count |
---|---|
39 | |
21 | |
19 | |
10 | |
9 |