Hey @KranthiPakala-MSFT , i was on PTO and didnot got any chance to test it. I will check it today and update it. Thank you for patience.
Handling If else conditions in stream analytics query
Hi,
I have one stream analytics query where i want to handle the condition like If today is a weekday then execute code1 else code2.
As stream analytics is not supporting IF else or subquery in Case statement how to handle this? Can I get some guidance here.
Below is my sample code,which is not working
SELECT(
CASE
WHEN DATEPART(WEEKDAY, SysTime) in (1,7) THEN
(
SELECT count() as Eventcount
INTO servicebusqueue
FROM Input Group By tumblingwindow(minute,5) Having Count(*) > 10 ) ELSE ( SELECT count(*) as Eventcount INTO servicebusqueue
FROM Input
Group By tumblingwindow(minute,5)
Having Count() < 10
)
END ) as DayStatus
FROM Input
Thanks in Advance.
2 answers
Sort by: Most helpful
-
-
Rock 41 Reputation points
2020-10-13T13:54:09.893+00:00 Hi @KranthiPakala-MSFT ,
Thanks for your patience.
I tried to add group by clause , but it requires all the fields in the select clause. So when we add EventTime in the group by it doesnot gives the desired output. It is grouping on every single values of eventTime(which is 1 second apart) and does not fulfill 5 minutes tumbling window group.
Please help.