Skip to content

Commit

Permalink
v1.4 work
Browse files Browse the repository at this point in the history
  • Loading branch information
James Dunkerley committed Feb 21, 2019
1 parent 459c5a7 commit 0926055
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DateUtils.Test/DatePartTest.yxmd
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,12 @@ Table=`Sheet1$`</DefaultAnnotationText>
<Properties>
<Configuration>
<FormulaFields>
<FormulaField expression="DATEPART([DateText], [Part])" field="Actual" size="8" type="Int64" />
<FormulaField expression="DATEPART([Part], [DateText])" field="Actual" size="8" type="Int64" />
</FormulaFields>
</Configuration>
<Annotation DisplayMode="0">
<Name />
<DefaultAnnotationText><![CDATA[Actual = DATEPART([DateText], [Part])
<DefaultAnnotationText><![CDATA[Actual = DATEPART([Part], [DateText])
]]></DefaultAnnotationText>
<Left value="False" />
</Annotation>
Expand Down
4 changes: 2 additions & 2 deletions DateUtils.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@
<Name>DATEPART</Name>
<NumParams variable="false">2</NumParams>
<Category>DateTime</Category>
<InsertText>DATEPART(DateTime, Part)</InsertText>
<InsertText>DATEPART(interval, dt)</InsertText>
<Description>Reproduces SQL Server's DatePart function. Support SQL servers standard parts as well as the numeric Alteryx date formatters.</Description>
<Formula>Switch(LOWERCASE(P2),NULL(),"year",Year(P1),"yyyy",Year(P1),"yy",Year(P1),"%y",Year(P1),"cc",Century(P1),"c",Century(P1),"%c",Century(P1),"quarter",Quarter(P1),"qq",Quarter(P1),"q",Quarter(P1),"month",Month(P1),"mm",Month(P1),"m",Month(P1),"dayofyear",OrdinalDay(P1),"dy",OrdinalDay(P1),"y",OrdinalDay(P1),"%j",OrdinalDay(P1),"day",DAY(P1),"dd",DAY(P1),"d",DAY(P1),"%d",DAY(P1),"%e",DAY(P1),"hour",HOUR(P1),"hh",HOUR(P1),"h",HOUR(P1),"%h",HOUR(P1),"%k",HOUR(P1),"mi",MINUTE(P1),"n",MINUTE(P1),"ss",SECOND(P1),"s",SECOND(P1),"%s",SECOND(P1),"%m",IIF(CharToInt(Right(P2,1))=77, MINUTE(P1),MONTH(P1)),"weekday",WEEKDAY(P1),"dw",WEEKDAY(P1))</Formula>
<Formula>Switch(LOWERCASE(P1),NULL(),"year",Year(P2),"yyyy",Year(P2),"yy",Year(P2),"%y",Year(P2),"century",Century(P2),"cc",Century(P2),"c",Century(P2),"%c",Century(P2),"quarter",Quarter(P2),"qq",Quarter(P2),"q",Quarter(P2),"month",Month(P2),"mm",Month(P2),"m",Month(P2),"dayofyear",OrdinalDay(P2),"dy",OrdinalDay(P2),"y",OrdinalDay(P2),"%j",OrdinalDay(P2),"day",DAY(P2),"dd",DAY(P2),"d",DAY(P2),"%d",DAY(P2),"%e",DAY(P2),"hour",HOUR(P2),"hh",HOUR(P2),"h",HOUR(P2),"%h",HOUR(P2),"%k",HOUR(P2),"mi",MINUTE(P2),"n",MINUTE(P2),"ss",SECOND(P2),"s",SECOND(P2),"%s",SECOND(P2),"%m",IIF(CharToInt(Right(P1,1))=77, MINUTE(P2),MONTH(P2)),"weekday",WEEKDAY(P2),"dw",WEEKDAY(P2))</Formula>
</Function>
</FormulaAddIn>
2 changes: 1 addition & 1 deletion MiscUtils.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<Description>Returns if a numeric value exists</Description>
<Dll>
<Name>AlteryxAbacus.dll</Name>
<EntryPoint>VarTextExists</EntryPoint>
<EntryPoint>VarNumExists</EntryPoint>
</Dll>
</Function>
<Function>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Some additional functions for working with Dates and to a certain extent Times.
- [WeekDay](https://github.com/jdunkerley/AlteryxFormulaAddOns/wiki/Date-and-Time-Functions-(DateUtils.xml)#weekday): Gets the day of the week [Sunday (0) through to Saturday (6)]
- [Quarter](https://github.com/jdunkerley/AlteryxFormulaAddOns/wiki/Date-and-Time-Functions-(DateUtils.xml)#quarter): Gets the quarter of the date [1-4]
- [OrdinalDay](https://github.com/jdunkerley/AlteryxFormulaAddOns/wiki/Date-and-Time-Functions-(DateUtils.xml)#ordinalday): Gets the day of the year [1-366]
- [DatePart](https://github.com/jdunkerley/AlteryxFormulaAddOns/wiki/Date-and-Time-Functions-(DateUtils.xml)#datepart): Replicates the SQL DatePart function, getting a specified part of the datetime input

#### Time Part Functions (returns numbers) ####

Expand Down
8 changes: 8 additions & 0 deletions StringUtils.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,12 @@
<EntryPoint>FromRoman</EntryPoint>
</Dll>
</Function>
<Function>
<Name>FINDSTRINGLAST</Name>
<NumParams variable="false">2</NumParams>
<Category>String</Category>
<InsertText>FINDSTRINGLAST(String, Target)</InsertText>
<Description>Searches for the occurrence of Target within String from end and returns the numeric position of it.</Description>
<Formula>FINDSTRING(REVERSE(P1),REVERSE(P2))</Formula>
</Function>
</FormulaAddIn>

0 comments on commit 0926055

Please sign in to comment.