BC22 - Remove Single Quotes from Filter Totals By

IrishGiri
Member Posts: 61
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.
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.
0
Answers
-
Use SetFilter("Lot No. Filter", '%1', ItemJournalLine."Lot No. Filter"); instead of BinContent.SetRange("Lot No. Filter", ItemJournalLine."Lot No. Filter");0
-
Thanks for your suggestion, but unfortunately that doesn't remove the quotes either end of the filter in the request page of the report. Same result, I'm afraid0
-
Try use DELCHR(ItemJournalLine."Lot No. Filter", '<>', Apostroph), where Apostroph is defined as a TextConstant with single quote.0
-
I think you mean DELCHR(ItemJournalLine."Lot No. Filter", '=', Apostroph , right?
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.0 -
Does anyone know if there is already any existing standard report in the Base Application that that takes a filter containing .. or | from a record on a page and, when the report is run from an action on that page, it has a Filter Totals By field initialized in its request page without a leading and trailing single quote???0
-
Your field contains a filter. Just set it. Use
SetFilter("Lot No. Filter", ItemJournalLine."Lot No. Filter");
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.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions