Walaa wrote:
What exactly did you try?
Are you using LLBLGen Low Level, Linq or QuerySpec?
I am using Low Level throughout the project, and I tried it with Low Level and with QuerySpec for this query. Here are a few things I've been trying:
With Low Leve I initialy tried to use the PredicateExpression with the following line
var filter = new PredicateExpression();
filter.Add(AgendaEventMetaFields.PatientId == patientId);
filter.Add((Helper.UnixTime.Today - AgendaEventMetaFields.RepeatStart) % AgendaEventMetaFields.RepeatInterval);
But that's not allowed, then I tried digging some more into the documentation and found the ExOp enum hoping that could help me out, but couldn't find how to use it, so I did some trying out and found that the Expression class accepted them so I just wrote this:
var firstExpression = new Expression(Helper.UnixTime.Today, ExOp.Sub, AgendaEventMetaFields.RepeatStart);
var secondExpression = new Expression(firstExpression, ExOp.Mod, AgendaEventMetaFields.RepeatInterval);
var thirdExpression = new Expression(secondExpression, ExOp.Equal, 0);
Then wondering if that is correct and if I can use it somewhere I did some more digging in the documentation and experimenting but I couldn't really figure it out. Then I thought maybe I can use it with QuerySpec and dynamic lists and at this point it was more a trial and error sort of thing so I can up with this:
//var qf = new QueryFactory();
var q = qf.Create()
.Select()
.From(qf.AgendaEventMeta
.RightJoin(qf.AgendaEvent)
.On(AgendaEventMetaFields.AgendaEventId == AgendaEventFields.Id))
.Where((IPredicate)thirdExpression)
.AndWhere(AgendaEventMetaFields.PatientId == patientId);
Since I can't get the where clause that I went I just started atempting multiple trial and error cases like this, knowing it'll probably wont work.
Also looked for a way to maybe apply the expression, but I just don't know on how to tackle this in llblgen, and can't seem to find the right information in the documentation.
And currently I just made a store procedure from the query, call the stored procedure with llblgen, and convert the datatable to a AgendaEventCollection, which gets the job done but I'd rather use the llblgen low level api than a stored procedure.