Is it possible to somehow create an advanced search function in NAV?
Etc. you are on customer list and you can search on Customer's Name, Adress and phone nr. in same search field without switching the filter.
So it would search in all of those fields just by typing search word in one place.
I have searched online if someone already did it but came up empty.
*This post is locked for comments
Try this object - it actually work for me
OBJECT Page 50080 Search Customer
{
OBJECT-PROPERTIES
{
Date=14/04/16;
Time=15:51:09;
Modified=Yes;
Version List=;
}
PROPERTIES
{
SourceTable=Table18;
PageType=List;
SourceTableTemporary=Yes;
}
CONTROLS
{
{ 1000000000;0;Container;
ContainerType=ContentArea }
{ 1000000011;1;Group ;
GroupType=Group }
{ 1000000012;2;Field ;
CaptionML=ENG=Type to search;
SourceExpr=SearchString;
OnValidate=BEGIN
DoSearch;
END;
}
{ 1000000001;1;Group ;
Name=Group;
GroupType=Repeater }
{ 1000000002;2;Field ;
SourceExpr="No." }
{ 1000000003;2;Field ;
SourceExpr=Name }
{ 1000000004;2;Field ;
SourceExpr="Search Name" }
{ 1000000005;2;Field ;
SourceExpr="Name 2" }
{ 1000000006;2;Field ;
SourceExpr=Address }
{ 1000000007;2;Field ;
SourceExpr="Address 2" }
{ 1000000008;2;Field ;
SourceExpr=City }
{ 1000000009;2;Field ;
SourceExpr=Contact }
{ 1000000010;2;Field ;
SourceExpr="Phone No." }
}
CODE
{
VAR
SearchString@1000000000 : Text;
LOCAL PROCEDURE DoSearch@1000000002();
VAR
Cust@1000000000 : Record 18;
BEGIN
Cust.RESET;
Cust.SETFILTER(Name, '@*' + SearchString + '*');
IF Cust.FINDSET THEN
REPEAT
INIT;
Rec := Cust;
IF INSERT THEN;
UNTIL Cust.NEXT = 0;
END;
BEGIN
END.
}
}
You can read about query object on MSDN, they surely explain better than i can. But my ide was to use ADO automation and query sql server directly from nav code. I used this approach before, for nav2009 - can't see why it wouldn't work.
Ok thanks alot, I will try that.
I haven't used queries together with nav before. Can you give an example on how to set this up?
Or, if there is not hundreds of thousands of customers - just use 4x filter& repeat loop to populate your table.
say:
cust.setfilter("Name", '@*%1*', searchstring);
if cust.findset then
repeat
insert temp record here
.........
repeat for each field
(take a look to filter - @ is to make it case insensitive and * is any char, i can't remember exact syntax)
I'd perhaps use automation or even .Net to query sql server directly. You can get your SQL server/database name from session table, use your company name to refer to correct sql table and then loop trough result of your sql query and populate temptable
SELECT Name, Address, [Phone No_] FROM [CRONUS Danmark A_S$Customer] WHERE Name LIKE '%searchword%' or Address LIKE '%searchword%' or [Phone No_] LIKE '%searchword%'
Ok cool, so how would you query this in nav?
Personally I would not loop, that is too slow. I would better to create queries to populate temp table. But generally, yes.
So its doable? How would you manage such thing?
Loop through etc. customer's name -> add to temp table if there are Records containing the name then Loop through Adress and add to temp table and then through phone nr. and then display the temp table?
Not with standard NAV. Doable by developing a custom search page...
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156