Hello everyone,
this time I've got a Problem that already exists in der Standard programming of NAV 2013, mayhap even earlier.
In one of our projects, I copied the Sales Prices Table and Page (7002 each) and did some small changes.
Imagine my surprise when I tried calling up the Page from different Areas and for over half of the time got error messages along the line of "The element of type 'Customer' was not found in Filter 'xy'.".
Of course I first thought it had something to do with my changes, but then I found out it was part of the Standard code. Trying it in the original Sales Prices gave me the same error Messages.
Now, the Sales Prices table has the Option-Field Sales Type (Customer,Customer Price Group,All Customers,Campaign). In the page you have the SalesTypeFilter at the top of the page, where you can set a Filter for the field Sales Type.
The Problem arises, because the SalesTypeFilter not only has the Options that field has, but at the back it also has the Option "None" (Customer,Customer Price Group,All Customers,Campaign,None). When one opens the page the first thing that happens is the Funktion GetFilters in OnOpen. In GetFilters, when the GETFILTERS for Sales Type is not Empty, then the Funktion GetSalesTypeFilter is called. This function has only one (!) line:
IF EVALUATE(SalesTypeFilter,GETFILTER("Sales Type")) THEN;
And that is my Problem, because this EVALUATE does. not. work!!!
For example: I call up the Sale Prices from the Item List Page. Because no Filter is set for Sales Type, the page opens with SalesTypeFilter set to "None". I Close the Page and call it up from the Customer List Page. There, the Action has the property RunPageLink set to "Sales Type=CONST(Customer),Sales Code=FIELD(No.)". So going by the intended code the page should open with the SaleTypeFilter set to Customer (and the SlaesCodeFilter to the Customer No.). Instead, the Filter is still set to "None". Changing the Filter to Customer, closing the page and opening it again from the Customer List, opens it with the correct Filter this time. But, when you now close the page and try opening it from Customer Price Group Page, you get the above mentioned error message. Opening it from the Item List sets the Filter back to "None".
Why does the EVALUATE not work? Is this a General Problem for using EVALUATE this way or would a hotfix help (Build is 7.0.34040.0)?
Thanks in advance for your help!
Ciao,
Lily
0
Comments
The value ends up in the variable SalesTypeValue.
FilterType := SalesPrice.GETFILTER("Sales Type");
IF FilterType <> '' THEN BEGIN
RecRef.GETTABLE(SalesPrice);
FieldRef := RecRef.FIELD(SalesPrice.FIELDNO("Sales Type"));
OptionStr := FieldRef.OPTIONCAPTION;
Count := STRLEN(OptionStr) - STRLEN(DELCHR(OptionStr,'=',','));
FOR i := 1 TO Count DO BEGIN
IF SELECTSTR(i,OptionStr) = FilterType THEN BEGIN
SalesTypeValue := i - 1;
i := Count;
END
END;
END;