forked from rileymd88/odag_wizard
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Riley MacDonald
committed
Feb 13, 2018
1 parent
a98c3ab
commit 9c98fd7
Showing
48 changed files
with
15,878 additions
and
42 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[autoCalendar]: | ||
DECLARE FIELD DEFINITION Tagged ('$date') | ||
FIELDS | ||
Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'), | ||
Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'), | ||
Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'), | ||
Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'), | ||
Month($1) AS [Month] Tagged ('$month', '$cyclic'), | ||
Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'), | ||
Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'), | ||
Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'), | ||
Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'), | ||
Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'), | ||
If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] , | ||
Year(Today())-Year($1) AS [YearsAgo] , | ||
If (DayNumberOfQuarter($1) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] , | ||
4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] , | ||
Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] , | ||
If(Day($1)<=Day(Today()),1,0) AS [InMTD] , | ||
12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] , | ||
Month(Today())-Month($1) AS [MonthRelNo] , | ||
If(WeekDay($1)<=WeekDay(Today()),1,0) AS [InWTD] , | ||
(WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] , | ||
Week(Today())-Week($1) AS [WeekRelNo] ; | ||
|
||
DERIVE FIELDS FROM FIELDS ExtendWhereDatesList USING [autoCalendar]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
FOR EACH fldname IN ExtendWhereList | ||
LET vallist = $(fldname); | ||
WHEN (IsNull(vallist)) LET vallist = ''; | ||
IF len(vallist) > 0 THEN | ||
CALL ExtendWhere('$(fldname)','vallist'); | ||
ENDIF | ||
NEXT fldname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
FOR EACH fldname IN ExtendWhereDatesList | ||
LET vallist = $(fldname); | ||
WHEN (IsNull(vallist)) LET vallist = ''; | ||
IF len(vallist) > 0 THEN | ||
CALL ExtendWhereDates('$(fldname)','vallist'); | ||
ENDIF | ||
NEXT fldname | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
SET OdagField =''; | ||
OdagBinding: | ||
LOAD * INLINE [ | ||
VAL | ||
$(OptionField_OdagField){"quote": "", "delimiter": ""} | ||
]; | ||
SET [OdagField_COLNAME]='OdagField'; | ||
CALL BuildValueList('OdagField', 'OdagBinding', 'VAL', 0); // 39 is for single quote wrapping values | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// DO NOT ALTER THIS SUBROUTINE | ||
SUB ExtendWhere(Name, ValVarName) | ||
LET T = Name & '_COLNAME'; | ||
LET ColName = $(T); | ||
LET Values = $(ValVarName); | ||
IF len(Values) > 0 THEN | ||
IF len(WHERE_PART) > 0 THEN | ||
LET WHERE_PART = '$(WHERE_PART) AND $(ColName) IN ( $(Values) )'; | ||
ELSE | ||
LET WHERE_PART = ' WHERE $(ColName) IN ( $(Values) )'; | ||
ENDIF | ||
ENDIF | ||
END SUB; | ||
|
||
// DO NOT ALTER THIS SUBROUTINE | ||
SUB ExtendWhereDates(Name, ValVarName) | ||
LET T = Name & '_COLNAME'; | ||
LET ColName = $(T); | ||
LET Values = $(ValVarName); | ||
IF len(Values) > 0 THEN | ||
LET WHERE_DTPART = ' AND DATE($(ColName)) IN ( $(Values) )'; | ||
ENDIF | ||
END SUB; | ||
|
||
// DO NOT ALTER THIS SUBROUTINE | ||
SUB FromTable(Name, ValVarName) | ||
LET T = Name & '_COLNAME'; | ||
LET ColName = $(T); | ||
LET TabValue = $(ValVarName); | ||
IF len(TabValue) > 0 THEN | ||
LET FROM_PART = '$(TabValue)'; | ||
ENDIF | ||
END SUB; | ||
|
||
// DO NOT ALTER THIS SUBROUTINE | ||
SUB BuildValueList(VarName, TableName, ColName, QuoteChrNum) | ||
IF ($(QuoteChrNum) = 0) THEN | ||
LET LOADEXPR = 'Concat($(ColName),' & chr(39) & ',' & chr(39) & ') AS CombinedData'; | ||
ELSE | ||
LET CHREXPR = ' chr(' & '$(QuoteChrNum)' & ') '; | ||
LET LOADEXPR = 'Concat( $(CHREXPR) & $(ColName) & $(CHREXPR)' & ',' & chr(39) & ',' & chr(39) & ') AS CombinedData'; | ||
ENDIF | ||
_TempTable: | ||
LOAD $(LOADEXPR) Resident $(TableName); | ||
Let vNoOfRows = NoOfRows('_TempTable'); | ||
IF $(vNoOfRows)> 0 THEN | ||
LET $(VarName) = Peek('CombinedData',0,'_TempTable'); | ||
ENDIF | ||
drop table _TempTable; | ||
drop table '$(TableName)'; | ||
END SUB; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
TRACE Generated WHERE clause: ; | ||
TRACE $(WHERE_PART); | ||
|
||
TRACE Generated WHERE clause for Dates: ; | ||
TRACE $(WHERE_DTPART); | ||
|
||
///$tab Fact | ||
// In this section you will need to add the detailed data load script and then add the variables $(WHERE_PART) and $(WHERE_DTPART) into your script | ||
|
||
///$tab Dimensional Data | ||
// In this section you will need to add dimensions into the application and use where exists to only load the dimensions which exist; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"config": [ | ||
{ | ||
"odagQuoteWrapping": 0 | ||
} | ||
] | ||
} |
Oops, something went wrong.