Maybe it's a stupid question but my brain is in a "idle" kind of mode today and I have this simple problem (so it seems).
I have to look up a list form which has to filtered on three different fields with the OR operator. I tried using the TableRelation property but the filtering there works only in AND mode.
I'll get myself some strong coffee now...
0
Answers
Do you want to filter on Field1 OR Field2 OR Field3?
Or do you want to filter Field1 on Value1 OR Value2, Field2 on Value3 OR Value4, Field3 on Value5 OR Value6?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
As the first option; three boolean fields bool1=true OR bool2=true OR bool3=true.
I'm doing that for one hour now but...as I wrote in my initial post.
I'm having my coffee now, maybe this will help.
This is with what I came up so far...
the form shows more than the desired/inserted records.
Well, like in the code the TRUE ones should be included the FALSE ones not.
Exactly. Sorry if I misunderstood the question (the coffee is not working - yet).
Well, the form basically shows all the items. Even those with someBool1 = TRUE. It simply ignores any filter or any SETRECORD/SETTABLEVIEW.
Is it me or...?
Yes I know. I also tried with SETTABLEVIEW (any combination you could imagine). The pasted code is only a snapshot in time.
Did I mention that "rec_tmp_item" is a temporary record type variable? Can it be that a temp variable cannot be used in this context (as a source for form lookup)? NAV online help says nothing on that matter.
But when I try to use the form as a variable (as shown in my previous post) it ignores the temp item variable totally. :-k
OK, can anyone tell me how to get the record from the lookup form by using "IF FORM.RUNMODAL(31,rec_tmp_item) = ACTION::LookupOK THEN..."
It's probably returned in rec_tmp_item.
I'm sorry but I don't know what you mean (I'm kind of slow today).
Anyway, I kind of solved it using MARK-s on rec_item and SETTABLEVIEW on the original form variable. I'm sort of frustrated by such NAV behavior. I really thought it was me...
The second which I find is the more common, is where the original system design was wrong, and instead of fixing the design, its easier to just blame Navision. In these cases, I look at the data model and fix it. It is often a big job to fix a badly constructed data model, but the performance and simplicity advantages are generally worth it.
A good example is Applied entries in Navision, for many versions they used marks, until they finally realized that it was simply a bad data model. They changed the model, and now its simple.
Thanks for the time you all!
I believe you'll have to copy the form, set the sourcetabletemp on true, and use this form instead. (But no guarantees)
This has crossed my mind to, what David means is that you could add another boolean field that is the result of the or.
so you have bool1,bool2, bool3,bool4,bool5 and boolOr.
BoolOr = bool3 OR bool4 OR bool5 (if I'm not mistaken)
|To-Increase|
I must admit I wasn't aware of that property (it isn't even listed in NAV help). Anyway, created a new form with that property set to "Yes", form is filled on Open trigger with that stupid "OR" filter and then finally the form gets called from the initial table field with GETRECORD.
Works like a charm...
Thanks again you all!
p.s.: That coffee thing isn't working, waiting for the day to end.