Skip to content

Instantly share code, notes, and snippets.

@hugith
Last active Nov 4, 2021
Embed
What would you like to do?
void performFetch() {
addDateTruncAttribute( editingContext, "SomeEntity", "checkInTimeTruncated", "check_in_time" );
addDateTruncAttribute( editingContext, "SomeEntity", "requestedTruncated", "requested" );
EOQualifier q = EOQualifier.qualifierWithQualifierFormat( "checkInTimeTruncated>=requestedTruncated", null );
// ...finish your fetch using the qualifier
}
static void addDateTruncAttribute( EOEditingContext ec, String entityName, String attributeName, String columnName ) {
EOAttribute attribute = new EOAttribute();
attribute.setName( attributeName );
attribute.setColumnName( columnName );
attribute.setReadFormat( "date_trunc('day',%P)" );
EOUtilities.entityNamed( ec, entityName ).addAttribute( attribute );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment