Call MySQL SUBTIME()

Posts   
 
    
aaw
User
Posts: 3
Joined: 17-Jun-2020
# Posted on: 17-Jun-2020 17:21:36   

Hello,

How can I call the MySQL SUBTIME() function in LLBLgen?

Kind regards, aaw

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 17-Jun-2020 23:58:28   

You didn't specify which version of LLBLGen are you using, which tenmplateSet and if you are using the Low Level APIs, Linq or QuerySPec.

If you are using the low level APIs, then using a DBFunctionCall Example:

new DbFunctionCall("SUBTIME({0}, '1:30')", new object[] {YourEntityFields.TimeField });

This is the Expression that you can use in a filter or in a select as shown in the above link.

For QuerySpec and Linq there is an extra step to define a function mapping. But if you can convert the time to minutes or hours, then you can use the built-in mapped function AddMinutes() or AddHours() and provide a negative value.

aaw
User
Posts: 3
Joined: 17-Jun-2020
# Posted on: 18-Jun-2020 12:07:33   

Thank you for your fast response. I am using version 5.6 of LLBLGen, SelfServicing and Linq.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 19-Jun-2020 16:53:59   

Did you get it sorted out, or do you still need help?

aaw
User
Posts: 3
Joined: 17-Jun-2020
# Posted on: 19-Jun-2020 17:00:42   

Hello Walaa,

Thank you for your help. I managed to do it using function mapping.

Kind regards, aaw