Is there a way to do IntervalMatch in Azure Data Factory? - azure

Im trying to do an IntervalMatch from the following link in ADF:
https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/IntervalMatch.htm
Is there an activity (Join, ...) or another way to achieve this?

I tried to repro this in ADF data flow with sample inputs and below is the approach.
Input tables:
Event_log:
Time
Event
Comment
0:00
0
Start of shift 1
1:18
1
Line stop
2:23
2
Line restart 50%
4:15
3
Line speed 100%
8:00
4
Start of shift 2
11:43
5
End of production
Order_log:
Start
End
Order
1:00
03:35
A
2:30
07:58
B
3:04
10:27
C
7:23
11:43
D
Source transformations (source1 and source2) are taken for the above tables.
Join transformation is taken. In Join settings
Source1 (Event Log) is taken as Left stream and Source2 (Order_log) is taken as right stream.
Join type is given as Right Outer.
Joining conditions are Start<=Time and End>=Time.
Output of Join Transformation:
Start
End
Order
Time
Event
Comment
NULL
NULL
NULL
0:00
0
Start of shift 1
1:00
3:35
A
1:18
1
Line stop
1:00
3:35
A
2:23
2
Line restart 50%
2:30
7:58
B
4:15
3
Line speed 100%
3:04
10:27
C
4:15
3
Line speed 100%
3:04
10:27
C
8:00
4
Start of shift 2
7:23
11:43
D
8:00
4
Start of shift 2
7:23
11:43
D
11:43
5
End of production

Related

Power Query change values in a cell on condition

I have a table with 100+ equipment. The sample is below:
Equipment
Rounded Start of operation
Rounded end of operation
eq1
01/09/2020 20:10
01/09/2020 20:15
eq1
01/09/2020 20:15
01/09/2020 20:40
eq2
01/09/2020 20:30
01/09/2020 20:45
eq2
01/09/2020 20:50
01/09/2020 21:55
As you can see the start of the second operation is the same as the end of the first operation for eq1.
I need to increase such start of the operation on 5 minutes.
I have tried to add 2 additional columns:
column_1 = equipment+rounded start of operation
column_2 = equipment+rounded end of operation.
Then I wanted to check if column_2 contains a value of column_1 but could not find any good way to do it. Table.Contains took around an hour to calculate everything.
Is there a better way to do it in Power Query?

How to define a Cron Expressions of Quartz 2

I read corn expression tutorial this and managed to make simple expressions like : 15 14 5 12 0 represents as
15(minutes)14(hours) 5(day-of-month) 12(month) 2(day-of-week) that means
At 14:15 on day-of-month 5 and on Sunday in December.
I didn't understand how do I define the repeated expression. I can write corn expression.
Every day at 01:00 a.m. Should be 0 1 * * *.
how to write an expression every last day of the month(end of the month) at 01:00 am?
I found a way to do it.
Daily at 1:00 A.M corn expression should be: 0 0 1 * * ?
The last day of any month at 1:00 A.M corn expression should be: 0 0 1 L * ?
I verified the expression by this http://www.cronmaker.com/. I have to apply it in my code now.

Generate a interval based time series using Spark SQL

I am new to Spark sql. I want to generate the following series of start time and end time which have an interval of 5 seconds for current date. So in lets say I am running my job on 1st Jan 2018 I want a series of start time and end time which have a difference of 5 seconds. So there will be 17280 records for 1 day
START TIME | END TIME
-----------------------------------------
01-01-2018 00:00:00 | 01-01-2018 00:00:04
01-01-2018 00:00:05 | 01-01-2018 00:00:09
01-01-2018 00:00:10 | 01-01-2018 00:00:14
.
.
01-01-2018 23:59:55 | 01-01-2018 23:59:59
01-02-2018 00:00:00 | 01-01-2018 00:00:05
I know I can generate this data-frame using a scala for loop. My constraint is that I can use only queries to do this.
Is there any way I can create this data structure using select * constructs?

Excel - If time between 2 cells

EXCEL - 1st row example; clocked IN at 08:20 - clocked OUT at 17:03
What I want to do is basically in 8:00-8:59 - if row 1 was between them times then output a 1, if not, then output a 0
Any help is greatly appreciated
Assuming 08:00-08:59 is in cell J1, then you can put this formula into J2:
=IF(AND($A2>=VALUE(LEFT(J$1,FIND("-",J$1)-1)),$A2<=VALUE(RIGHT(J$1,LEN(J$1)-FIND("-",J$1)))),1,0)
Storing the time parameters as text forces the use of the VALUE function. Shifting everything down a row and putting the start of the hour in row 1 and the end of the hour in row 2 so it looks like this:
08:00 09:00 10:00 11:00 12:00
Clock1 C1 Clock2 C2 Clock3 C3 Clock4 C4 08:59 09:59 10:59 11:59 12:59
08:20 I 17:03 X
10:20 I 16:03 X
08:00 I 18:00 O
10:11 I 17:00 O
Would change the formula to:
=IF(AND($A3>=J$1,$A3<=J$2),1,0)

MDB query for Time

I have table as
Id Name Date Time
1 S 1-Dec-2009 9:00
2 N 1-Dec-2009 10:00
1 S 1-Dec-2009 10:30
1 S 1-Dec-2009 11:00
2 N 1-Dec-2009 11:10
Need query to display as
Id Name Date Time
1 S 1-Dec-2009 9:00
1 S 1-Dec-2009 11:00
2 N 1-Dec-2009 10:00
2 N 1-Dec-2009 11:10
My backend database is MS Access and using VB6 for Max and Min time
I would make an additional two [int] columns, say hour and minute and then use an MS Access query to sort them. It would be MUCH easier to call that in VB. The query itself would be something like the following:
SELECT * FROM YOURTABLE ORDER BY id, hour, minute;

Resources