3 Comments

If you want to use datedif to filter on a date, you can use code like:

        public EntityCollection<Customers> GetCustomers(DateTime creationDate)
        {
            EntityCollection<AfhaalopdrachtEntity> result = new EntityCollection<AfhaalopdrachtEntity>();

            // Filter
            IRelationPredicateBucket filter = new RelationPredicateBucket();

            IPredicate customerCreateDateFilter = new EntityField2("CreateCustomerDiff", new DbFunctionCall("DATEDIFF(day, {0}, {1})", new object[] { CustomerFields.CreationDate, creationDate})) == 0;
            filter.PredicateExpression.Add(customerCreateDateFilter );

            // Fetch (get the data)
            using (DataAccessAdapter da = ConnectionHelper.GetAdapter(Source.Pegaso, Global.Logger))
            {
                da.FetchEntityCollection(result, filter);
            }

           return result;
        }

3 Replies to “How to use datediff with LLBLGen Pro”

  1. Thanks this was really handy… One question?

    What’s a AfhaalopdrachtEntity 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts