Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 martin_hamilton
		
			martin_hamilton
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
I am imported data which has a string column which has the days of the week included in it e.g. MON, TUES, WEDS, etc
How do I convert on a load so I can sequence them in order.
I have seen the daynames function mentioned but dont quite understand how it would work in this instance - if at all?
Many Thanks
Martin
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		May be using a mapping load
MappingLoad:
Mapping
LOAD * INLINE [
Day, Sequence
MON, 1
TUE, 2
WED, 3
THU, 4
FRI, 5
SAT, 6
SUN, 7
];
and then
Fact:
LOAD DayName,
ApplyMap('MappingLoad', DayName, Null()) as Sequence
....
FROM ....;
 
					
				
		
 el_aprendiz111
		
			el_aprendiz111
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
ORDER:
 load
 DUAL ( Day,Order ) as DayOfWeek 
inline 
 [ Day,Order 
 Monday,0 
 Tuesday,1 
 Thursday,3 
 Friday,4 
 Saturday,5 
 Sunday,6
 Wednesday,2 
 ];  

 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		May be using a mapping load
MappingLoad:
Mapping
LOAD * INLINE [
Day, Sequence
MON, 1
TUE, 2
WED, 3
THU, 4
FRI, 5
SAT, 6
SUN, 7
];
and then
Fact:
LOAD DayName,
ApplyMap('MappingLoad', DayName, Null()) as Sequence
....
FROM ....;
 
					
				
		
 sergio0592
		
			sergio0592
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You probably have a date field in your data, so use weekday() function:
Orders:
LOAD
*,
WeekDay(Date) as Day
INLINE [
Date, Orders_nb, owner,foreign
01/04/2017,234,C,0
02/04/2017,300,C,1
03/04/2017,867,B,0
04/04/2017,908,A,0
];
and sort Day with numeric value

 martin_hamilton
		
			martin_hamilton
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks Sunny - just what I needed. Unfortunately I have no dates in my data apart from minutes in the week to determine the day of the week so calculated that before i loaded but didnt think of placing a sequence in it at the same time.
