cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
GaganMehrok
Level: Powered On

DateTime SQL Query Field Value not showing

Hi 

 

I am trying to create a flow where i want to fetch data from SQL using GetRows and than put conditions on a column which is DateTime in nature. 

 

My Flow look like below. 

1.PNG

 

 

I get out as below 

 

{
  "@odata.context": "https://firstrelease-001.azure-apim.net/apim/sql/51fb27af256b47659d51c4a7ac227bb9/$metadata#datasets('default')/tables('%5Bdbo%5D.%5BRP_t_Count_CatalogTask%5D')/items",
  "value": [
    {
      "@odata.etag": "",
      "ItemInternalId": "f725d65f-a699-484d-bffd-b3fa5593babc"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "4703e20e-e1b4-48ae-8635-d91e1421c69b"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "e37c158a-f3ff-4d95-8b53-463597936e8d"
    },

I am not getting value of the Task_due_date i am selecting in GetRows.

 

Futher i want to compare the datetime value with greater and less than function. 

 

In below logic i am just testing to see the results for all those rows which has due date greater than utcnow(). 

 

@equals(item()?['Task_due_date'], greater(formatDateTime(item()?['Task_due_date'], 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd')))

Though my final logic will see Task_due_date > 1 Jan, 2018 and < utcnow(). What would be definiation for that?

 

Any help or guidance is appreciated. Thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: DateTime SQL Query Field Value not showing

Hi @GaganMehrok,

 

Could you please show a bit more about your SQL table?

Is the Task_due_date column a DateTime column in your SQL table?

 

I have created a SQL table in my SQL Server database and the data structure of it as below:21.JPG

 

For your first question, I have made a test on my side and don't have the issue that you mentioned. My flow's configuration as below:22.JPG

The flow works successfully as below:23.JPG

The output I got as below:

{
  "@odata.context": "https://asia-001.azure-apim.net/apim/sql/shared-sql-eb78766e-32e6-4776-8d37-c7cb1e8c69e3/$metadata#datasets('default')/tables('%5Bdbo%5D.%5BTaskLists1%5D')/items",
  "value": [
    {
      "@odata.etag": "",
      "ItemInternalId": "8268ceb8-d8c1-4922-b433-2eafd6f84406",
      "Task_due_date": "2018-03-12T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "6731841d-d091-4041-9185-c4bc81166728",
      "Task_due_date": "2018-03-11T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "a8f4e43b-8ea1-40f7-a8e1-41fd286d5544",
      "Task_due_date": "2018-03-10T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "49f99b4f-af8a-4c35-ab27-c25d0c9dc5c7",
      "Task_due_date": "2018-03-09T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "9a4132c1-6827-4f93-8907-5862885da05a",
      "Task_due_date": "2018-03-14T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "cd7b17fa-6efe-4275-997b-6de065d7a5d4",
      "Task_due_date": "2018-03-15T00:00:00Z"
    }
  ]
}

Please check if you have filled proper field within Select Query field of "Get rows" action.

 

For your second question, could you please share a screenshot of your flow's configuration? I think there is something wrong with the formula that you provided. 

If you want to filter rows which has due date greater than utcnow(), please take a try with following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get rows" action, specify Table name.
  • Add a "Filter array" action, From set to output of "Get rows" action. Click "Edit in advanced mode", type the following formula:
@greater(formatDateTime(item()?['Task_due_date'], 'yyyy-MM-dd'), utcNow('yyyy-MM-dd'))

Image reference:24.JPG

The flow works successfully as below:25.JPG

 

 

If you want to filter rows which has Task_due_date > 1 Jan, 2018 and < utcnow(), please take a try with above solution that I provided, then within "Filter array" action, click "Edit inadvanced mode", type the following formula:

@and(greater(formatDateTime(item()?['Task_due_date'], 'yyyy-MM-dd'), formatDateTime('2018-01-01T00:00:00Z', 'yyyy-MM-dd')),less(formatDateTime(item()?['Task_due_date'], 'yyyy-MM-dd'), utcNow('yyyy-MM-dd')))

Image reference:26.JPG

The flow works successfully as below:27.JPG

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: DateTime SQL Query Field Value not showing

Hi @GaganMehrok,

 

Could you please show a bit more about your SQL table?

Is the Task_due_date column a DateTime column in your SQL table?

 

I have created a SQL table in my SQL Server database and the data structure of it as below:21.JPG

 

For your first question, I have made a test on my side and don't have the issue that you mentioned. My flow's configuration as below:22.JPG

The flow works successfully as below:23.JPG

The output I got as below:

{
  "@odata.context": "https://asia-001.azure-apim.net/apim/sql/shared-sql-eb78766e-32e6-4776-8d37-c7cb1e8c69e3/$metadata#datasets('default')/tables('%5Bdbo%5D.%5BTaskLists1%5D')/items",
  "value": [
    {
      "@odata.etag": "",
      "ItemInternalId": "8268ceb8-d8c1-4922-b433-2eafd6f84406",
      "Task_due_date": "2018-03-12T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "6731841d-d091-4041-9185-c4bc81166728",
      "Task_due_date": "2018-03-11T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "a8f4e43b-8ea1-40f7-a8e1-41fd286d5544",
      "Task_due_date": "2018-03-10T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "49f99b4f-af8a-4c35-ab27-c25d0c9dc5c7",
      "Task_due_date": "2018-03-09T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "9a4132c1-6827-4f93-8907-5862885da05a",
      "Task_due_date": "2018-03-14T00:00:00Z"
    },
    {
      "@odata.etag": "",
      "ItemInternalId": "cd7b17fa-6efe-4275-997b-6de065d7a5d4",
      "Task_due_date": "2018-03-15T00:00:00Z"
    }
  ]
}

Please check if you have filled proper field within Select Query field of "Get rows" action.

 

For your second question, could you please share a screenshot of your flow's configuration? I think there is something wrong with the formula that you provided. 

If you want to filter rows which has due date greater than utcnow(), please take a try with following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get rows" action, specify Table name.
  • Add a "Filter array" action, From set to output of "Get rows" action. Click "Edit in advanced mode", type the following formula:
@greater(formatDateTime(item()?['Task_due_date'], 'yyyy-MM-dd'), utcNow('yyyy-MM-dd'))

Image reference:24.JPG

The flow works successfully as below:25.JPG

 

 

If you want to filter rows which has Task_due_date > 1 Jan, 2018 and < utcnow(), please take a try with above solution that I provided, then within "Filter array" action, click "Edit inadvanced mode", type the following formula:

@and(greater(formatDateTime(item()?['Task_due_date'], 'yyyy-MM-dd'), formatDateTime('2018-01-01T00:00:00Z', 'yyyy-MM-dd')),less(formatDateTime(item()?['Task_due_date'], 'yyyy-MM-dd'), utcNow('yyyy-MM-dd')))

Image reference:26.JPG

The flow works successfully as below:27.JPG

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 347 members 6,323 guests
Please welcome our newest community members: