Created
June 3, 2021 22:27
-
-
Save vody/716b0b7bd5c817ec5365299618049fa3 to your computer and use it in GitHub Desktop.
autocomplete-ui-al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pageextension 50000 CustomerCard extends "Customer Card" | |
{ | |
layout | |
{ | |
addafter("No.") | |
{ | |
field(Control50000; Name) | |
{ | |
ApplicationArea = All; | |
Caption = 'Name'; | |
ToolTip = 'Specifies the customer''s name. This name will appear on all sales documents for the customer.'; | |
LookupPageId = SomethingList; | |
TableRelation = Something.Name; | |
} | |
} | |
modify(Name) | |
{ | |
Visible = false; | |
} | |
} | |
var | |
Name: Text; | |
trigger OnAfterGetCurrRecord() | |
begin | |
Name := Rec.Name; | |
end; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table 50000 Something | |
{ | |
Access = Internal; | |
TableType = Temporary; | |
LookupPageId = SomethingList; | |
fields | |
{ | |
field(1; Name; Text[250]) | |
{ | |
Caption = 'Name'; | |
} | |
} | |
keys | |
{ | |
key(PK; Name) | |
{ | |
Clustered = true; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page 50000 SomethingList | |
{ | |
Caption = 'Somethings'; | |
PageType = List; | |
SourceTable = Something; | |
SourceTableTemporary = true; | |
SourceTableView = sorting(Name); | |
layout | |
{ | |
area(Content) | |
{ | |
repeater(Group) | |
{ | |
field(Name; Rec.Name) | |
{ | |
ApplicationArea = All; | |
ToolTip = 'Name'; | |
} | |
} | |
} | |
} | |
trigger OnFindRecord(Which: Text): Boolean | |
var | |
NameValue: Text[250]; | |
begin | |
Rec.FilterGroup(-1); | |
Evaluate(NameValue, ExtractValueFromFilter(Rec.GetFilter(Name))); | |
Rec.Reset(); | |
Rec.DeleteAll(); | |
Rec.Init(); | |
if StrLen(NameValue) > 2 then | |
Rec.Name := NameValue | |
else | |
Rec.Name := Format(3 - StrLen(NameValue)) + ' more characters to go... ' + NameValue; | |
Rec.Insert(); | |
Rec.SetFilter(Name, '@*' + NameValue + '*'); | |
exit(Rec.Find(Which)) | |
end; | |
local procedure ExtractValueFromFilter("Filter": Text): Text | |
begin | |
if StrLen("Filter") > 3 then | |
exit("Filter".Substring(3).TrimEnd('*')) | |
end; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment