cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shantanu97
Frequent Visitor

count the number of entries in a view in SQL server in Power automate

I need to create a simple flow which essentially counts the number of entries in the SQL Server table, then on condition check it whether it is greater than zero or not? If it is greater than zero send an email otherwise do nothing.

 

The error is coming

 

Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language function 'greater' expects all of its parameters to be either integer or decimal numbers. Found invalid parameter types: 'Object'.'.

 

 

The condition block is always failing.

 

This is the SQL query that I want to execute it.

 

SELECT count(*)
FROM [dbo].[ViewName]
where TriggerReport=1

 

 

My View/table look like this 

 

CREATE VIEW [dbo].[ViewName] AS

SELECT
    order_id, 
    required_date, 
    shipped_date,
    CASE
        WHEN DATEDIFF(day, required_date, shipped_date) < 0
        THEN 1
        ELSE 0
    END TriggerReport
FROM 
    sales.orders
	
GO;	

 

 

Flow look like this

shantanu97_0-1651980993876.png

 

1 REPLY 1
vivekpande18
Super User
Super User

@shantanu97 ,

 

You need to use length() expression to check the number of items present inside the views.

 

So expression goes like this.

length( Output of your Compose action )

 

You can use above expression in your condition to check if the entries are greater than 0.

 

Thanks,

Vivek

 

If this answer your query then accept this as solution and if you like the response then don't forget to provide thumbs up.

 

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,267)