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

SQL get rows (v2) The provided value is of type 'Null'

Hello,

i have a problem with my flow. Whenever i try to filter query in the Get rows (V2) i get the error code: The provided value is of type 'Null'. When I remove the filter query it works fine. The Compose counts the rows which works fine when I have no filter query.

The expression in the Compose i use is the following: length(outputs('Get_rows')?['body/value']). I tested The Values of the filter query status with: 3, Fehler, Im Wartezustand. The Expression from the modifiedDateTime is :formatDateTime(utcNow(), 'yyyy-MM-dd')

 

Nico_B_0-1669722974309.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Nico_B
Frequent Visitor

My Solutions are the following: The problem with the status was just to write it Case sensitive so the result was STATUS eq 3 without the single quotes. For the ModifiedDateTime I searched and found this thread: https://powerusers.microsoft.com/t5/Building-Flows/SQL-Get-Rows-Filter-Query-not-working-for-DateTim... The Solution was to convert the ModifiedDateTime in the Filter query. 

STATUS eq 3 and date(MODIFIEDDATETIME) ge date(@{startOfDay(utcNow())}) and date(MODIFIEDDATETIME) le date(@{startOfDay(addDays(utcNow(), 1))})

And after the convert of the ModifiedDateTime it worked with the help of @grantjenkins and @Sundeep_Malik Thanks to both of you.

View solution in original post

15 REPLIES 15
Sundeep_Malik
Community Champion
Community Champion

Hey @Nico_B 

 

Some things that I noticed:

 

  • the formatdatetime expression, use single quotes around it:

           modifiedDateTime eq 'expression'

  • Next thing, try the filter queries separately, test if they are working separately.
  • Make sure the format date time is same as in your sql database. 

 

Do the above, lets see the result. 

 

Hello @Sundeep_Malik,

thank you for your response. I tried the first to things from the above but with the same error. The modifiedDateTime i get in my query is the following: 

Nico_B_0-1669729094664.png

I do not think that it is the main key why it could not work, because the status alone does not work aswell.

Sundeep_Malik
Community Champion
Community Champion

@Nico_B 

 

So, there must be a problem with the status column as well, can you show what error you got there?

 

Now for the formatdatetime expression.

 

I will be able to get the yyyy-MM-dd hh:mm:ss 

But I am not sure how I can get that 000. So, can you change it somehow in the sql database, if its possible otherwise try this expression:

 

formatDateTime('yyyy-MM-dd hh:mm:ss.000')

I get the same error for both. Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Null'. For the formatdatetime expression, i Intend to get the rows which are from the day the flow runs timespan would be from 00:00 today to 23:59 today.

Sundeep_Malik
Community Champion
Community Champion

Oops, not sure whats happening.

@grantjenkins 

Can you take this post? I am a little busy[Travelling] Sorry!

grantjenkins
Community Champion
Community Champion

Since you've got time as part of your date/time in SQL you'll need to approach it slightly differently. You can use the expression startOfDay to get the start of today and start of tomorrow then check if your date/time is between those times. See expression below. Note that you would check for greater or equal to (ge) for today, and less than (lt) for tomorrow. I would check to see if this works without your Status filter. I based the MODIFIEDDATETIME column name from what you said you got back from SQL. Also note that you'll need to add the startOfDay expressions within single quotes as below.

 

MODIFIEDDATETIME ge '@{startOfDay(utcNow())}' and MODIFIEDDATETIME lt '@{startOfDay(addDays(utcNow(), 1))}'

 

grantjenkins_0-1669731129353.png

 

For Status - what I would probably do first is run your Get rows without a filter, then look at the output and ensure you are using the correct column name in your query (needs to be exactly the same as what you see in your output).

 

Then add the Status filter query to the end of the date query with another and.

 

If your Modified Date filter isn't working, I'd check that column name in the output to ensure it's as expected too.

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

@grantjenkins thanks for your reply. I managed to search through the output and i just changed the filter query from: Status eq '3' to STATUS eq 3 without the single quotes and in caps it works. The time is still a problem, with my last expression: MODIFIEDDATETIME eq '@{formatDateTime(utcNow(), 'yyyy-MM-dd')}' in caps i don't get the error message but my row count goes from 3 to 0. The Expression you send me got me the error code even with the MODIFIEDDATETIME in Caps.

Are you able to send through a screenshot of your entire filter query, or paste the entire expression (including modified date time and status) just to confirm it's as expected?



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Nico_B_0-1669733862383.png

MODIFIEDDATETIME eq '@{formatDateTime(utcNow(), 'yyyy-MM-dd')}' and STATUS eq 3
 
Obvious with this i will not get my desired output but i don't get any error codes now.

That looks different to what I mentioned for the date/time filter. Try pasting in the following. Note that you would paste this directly into the Filter Query box.

 

MODIFIEDDATETIME ge '@{startOfDay(utcNow())}' and MODIFIEDDATETIME lt '@{startOfDay(addDays(utcNow(), 1))}' and STATUS eq 3

 

 

grantjenkins_0-1669734233373.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.
grantjenkins
Community Champion
Community Champion

@Nico_B Just wondering how you're going with the date filter part?

 

The expression I posted earlier should be pasted direction into the Filter Query box (not in the expression section).

MODIFIEDDATETIME ge '@{startOfDay(utcNow())}' and MODIFIEDDATETIME lt '@{startOfDay(addDays(utcNow(), 1))}' and STATUS eq 3

 

grantjenkins_0-1669764842953.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Sorry for my late response, when I paste it like this i get the same error code.

Nico_B_0-1669788667676.png

Nico_B_1-1669788684647.png

 

Are you certain you have some records where the modified date is today?

 

And what is the expression you have in your Compose? I can see that you're using the length expression, but not sure what you're trying to find the length of.

 

Can you check the body of your Get rows action to see if any results are coming back?



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

The modifiedDateTime is in my table for example here:

Nico_B_0-1669794864305.png

When I execute my SQL query I get the modifedDateTime back aswell

 

When I don't have any filter querys active the output from the get rows modifieddatetime looks like this

Nico_B_1-1669794933179.png

The expression in the Compose is 

length(outputs('Get_rows')?['body/value'])

 

Nico_B
Frequent Visitor

My Solutions are the following: The problem with the status was just to write it Case sensitive so the result was STATUS eq 3 without the single quotes. For the ModifiedDateTime I searched and found this thread: https://powerusers.microsoft.com/t5/Building-Flows/SQL-Get-Rows-Filter-Query-not-working-for-DateTim... The Solution was to convert the ModifiedDateTime in the Filter query. 

STATUS eq 3 and date(MODIFIEDDATETIME) ge date(@{startOfDay(utcNow())}) and date(MODIFIEDDATETIME) le date(@{startOfDay(addDays(utcNow(), 1))})

And after the convert of the ModifiedDateTime it worked with the help of @grantjenkins and @Sundeep_Malik Thanks to both of you.

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.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (4,249)