X-CGP-ClamAV-Result: CLEAN X-VirusScanner: Niversoft's CGPClamav Helper v1.22.2a (ClamAV engine v0.102.2) From: "Hugi Thordarson" Received: from mail-02.1984.is ([185.112.145.70] verified) by post.selbstdenker.com (CommuniGate Pro SMTP 6.3.7) with ESMTPS id 26738701 for webobjects-dev@wocommunity.org; Thu, 04 Nov 2021 11:13:04 +0100 Received-SPF: none receiver=post.selbstdenker.com; client-ip=185.112.145.70; envelope-from=hugi@karlmenn.is Received: from localhost by mail-02.1984.is with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1miZjd-0003Fv-1H for webobjects-dev@wocommunity.org; Thu, 04 Nov 2021 10:12:41 +0000 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\)) Subject: Re: [WO-DEV] How would you create such an EOQualifier representing Postgresql date_trunc(...)? Date: Thu, 4 Nov 2021 10:12:40 +0000 References: To: WebObjects & WOnder Development In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3693.20.0.1.32) Could also use a read format. Just tested this and seems to work: https://gist.github.com/hugith/c97ec7b15b29db8912506db75af9f412 Then there's good old EOSQLQualifier. It's deprecated, but what isn't = these days :) new EOSQLQualifier( EOUtilities.entityNamed( ec, "SomeEntityName" ), = "date_trunc('day', CHECK_IN_TIME) >=3D date_trunc('day', REQUESTED)", = null ); - hugi > On 3 Nov 2021, at 22:15, Ramsey Gurley = wrote: >=20 > Hi Markus, >=20 > You could create a derived attribute in your model for the truncated = value, but it would calculate that every time you fetch rows as well. >=20 > Ramsey >=20 >> On Nov 3, 2021, at 9:48 PM, Markus Ruggiero (rucotec) = wrote: >>=20 >> No one? >> I can live with raw rows but would have been great if anyone knows >>=20 >> ---markus--- >>=20 >>> On 1 Nov 2021, at 12:54, Markus Ruggiero (rucotec) = wrote: >>>=20 >>> Need to find objects satisfying the following condition: >>>=20 >>> CHECK_IN_TIME must be at least on the same day or later than = REQUESTED. Both values are stored as NSTimestamp with a 15 minutes = precision. >>>=20 >>> In Postgres I would write >>>=20 >>> ...where date_trunc('day', CHECK_IN_TIME) >=3D date_trunc('day', = REQUESTED) >>>=20 >>> How can I create a qualifier for this? Is this possible at all or do = I have to resort to raw rows for SQL? >>>=20 >>> Thanks >>> ---markus--- >>>=20 >>>=20 >>>=20 >>> Markus Ruggiero >>>=20 >>> rucotec GmbH web https://rucotec.ch >>> Steinenvorstadt 79 email markus.ruggiero@rucotec.ch >>> 4051 Basel / Switzerland mobile +41 79 508 4701 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>=20 >>=20 >=20 > Confidentiality Notice: This email, including all attachments and = replies thereto, are covered by the Electronic Communications Privacy = Act, 18 U.S.C. Sections 2510-2521 and are legally privileged. This = information is confidential, and intended only for the use of the = individuals or entities named above. If you are not the intended = recipient, you are hereby notified that any disclosure, copying, = distribution or the taking of any action in reliance on the contents of = this transmitted information is strictly prohibited. Please notify us if = you have received this transmission in error. Thank you.