Handling If else conditions in stream analytics query

Rock 41 Reputation points
2020-09-30T15:40:40.947+00:00

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.

Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
331 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rock 41 Reputation points
    2020-10-12T13:15:36.727+00:00

    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.

    0 comments No comments

  2. 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.

    0 comments No comments