Hi all,
I am trying to find a way, without much success, to remove the leading and trailing single quotes that somehow get included when passing a custom field of Type Text in the Item Journal Line, e.g LOT0000067|LOT0000069..LOT0000071 (without single quotes), to the Filter Totals By field called "Lot No. Filter" in the Get Contents Bin report below. In the Request Options form of the report the string shows up as 'LOT0000067|LOT0000069..LOT0000071' (with single quotes!)
Annoyingly, the report only works when the leading and trailing single quotes are removed manually, not very user-friendly, but I can't find where to remove them via code???
This is the code I use to populate the filters on the report request form:
[EventSubscriber(ObjectType::Page, Page::"Item Reclass. Journal", 'OnActionGetBinContentOnAfterSetFilters', '', false, false)]
local procedure "Item Reclass. Journal_OnActionGetBinContentOnAfterSetFilters"(var ItemJournalLine: Record "Item Journal Line"; var BinContent: Record "Bin
Content")
begin
BinContent.SetRange("Bin Code", ItemJournalLine."Bin Code");
BinContent.SetRange("Item No.", ItemJournalLine."Item No.");
BinContent.SetRange("Lot No. Filter", ItemJournalLine."Lot No. Filter");
end;
Any suggestions woud be gratefully appreciated! 👍
Paul.
Answers
Either way, this doesn't remove the single quotes in the request page. The ItemJournalLine."Lot No. Filter" is correct, with no single quotes. Then when the request page opens, the value for Lot No. Filter there continues to have single quotes.
SetRange quotes the value so in the end it finds a record with the value specified. That is, what the function is designed to do.
SetFilter is a bit more complicated. I have documented my findings in the following posts:
Filtering question
Percentage Sign handling in NAV is dangerously flaky.