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

datetime filter on Oracle data

Hi,

 

I am building a flow where I am trying to get rows from a Oracle database table. I am trying to take last 30 days data by filtering a date column in the table. But I keep getting below error no matter what operator I use. It is working only for 'eq' operator, but any other operator like 'ge' throws the same error with < symbol.

 

I searched through forums and looks like many people faced this issue with date fields. Some workaround suggest to create new number field in table to store the date. Is there any other work around without altering the table structure in database?

 

{
  "status"400,
  "message""We cannot apply operator < to types DateTimeZone and DateTime.\r\n     inner exception: We cannot apply operator < to types DateTimeZone and DateTime.\r\nclientRequestId: 7d833c5e-64fd-4c63-8789-a38a4c81a1d9",
  "source""oracle-eus.azconn-eus.p.azurewebsites.net"
}

 

Flow and the error screenshot is provided below,

 

Flow1.JPGOutput1.JPGOutput2.JPG

6 REPLIES 6
Community Support Team
Community Support Team

Re: datetime filter on Oracle data

Hi @itsgowthaman,

 

Thanks for sharing the detailed information.

 

Could you try to use the following code on your side to see if it will work?

1.PNG2.PNG

 

Doc on Odata filter query for reference:

https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

 

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
itsgowthaman
Level: Powered On

Re: datetime filter on Oracle data

Hi @v-yamao-msft,

 

I saw this workaround as well in previous posts, but this will not help always. Eg. if we run this in January 2019, I think it will fail since the month of UTCNOW will return 01, but the actual date in the condition will return 09 and hence it will fail. I am trying to take past 8 hours data from a table, but if I use hour it will fail for previous day 11 PM records since that will be higher than the current time when run in morning.

 

Is there a simple way to take this data? Oracle do not have Date and Datetime datatype separately and I dont see any way to take past 8 hours data, I thought it will be simple when I started.

Highlighted
itsgowthaman
Level: Powered On

Re: datetime filter on Oracle data

Hi @v-yamao-msft,

 

Upon further checking the above issue, if direct condition cannot be used I thought converting it to the format YYYYMMDDHHMI should work with greater than condition irrespective of when it is run. So I tried this as shown in screenshot below, but the concatenation failed saying it cannot concatenate two numbers. I tried to convert it, but the String function is not getting recognized when used there. I am trying to achiever something like below formula, but not sure how to use the conversion function along with Oracle column. (Note: for simple understanding of concept, I am using only year and month for now and used direct value on right side instead of UTCNOW function)

 

Value(Concat(String(year(X_CREATION_TIME)), String(month(X_CREATION_TIME)))) ge 201809

 

Flow2.JPG

grazzhopper
Level: Powered On

Re: datetime filter on Oracle data

Hi @itsgowthaman,

 

Did you eventually solve it?

 

As I have the same issues with the Oracle connector and seem to be unable to query a table with a DATE type field (INSUPDTIMESTAMP) formatted '2018-10-30 14:22:31' in an Oracle table and retrieve only records that are greater then for example utcNow().

 

Rather annoying.

 

Even the suggested workaround method with querying like undermentioned does not give the right results.

BOOKING ne null and year(INSUPDTIMESTAMP) ge year(@{outputs('Opstellen')}) and month(INSUPDTIMESTAMP) ge month(@{outputs('Opstellen')}) and day(INSUPDTIMESTAMP) ge day(@{outputs('Opstellen')}) and hour(INSUPDTIMESTAMP) ge hour(@{outputs('Opstellen')}) and minute(INSUPDTIMESTAMP) ge minute(@{outputs('Opstellen')}) and second(INSUPDTIMESTAMP) ge second(@{outputs('Opstellen')})

 

If you've found a solution I'd appreciate it! Otherwise @v-yamao-msft, perhaps this will be developped for the Oracle connector soon?

 

Love to hear you guys,

grtz,

grazz.

itsgowthaman
Level: Powered On

Re: datetime filter on Oracle data

@grazzhopper,

 

No, it did not work for me as well properly. Hopefully they will have a solution for this soon.

grazzhopper
Level: Powered On

Re: datetime filter on Oracle data

Hi, @itsgowthaman

 

Indeed.

 

Perhaps as a quick-and-dirty help in the meantime and how I worked around it: I'm having our database engineers add a trigger to the tables I need regular updates from. The changedatetime will be stored as an Integer in the form of [yyyyMMddHHmmss]. So 2018-11-16 15:15:22 will be 20181116151522 with an index on it. No the most elegant of solutions and you hav to take care of timezones yourself without a proper timestamp, but it gives the desired result I needed.

 

I can query the tables now with a simple odata filter [UPDATETIMESTAMP ge 20181116151522] and get the records on that timestamp and later with teh Oracle Connector.

 

Perhaps you can take advantage of this method also, you never know; but the best thing will be that it will be facilitaited properly withing teh premium connector. ;-)

 

Have a good weekend!

grtz,

grazz.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 48 members 4,257 guests
Please welcome our newest community members: