Search function for multiple tables

MartinFK
Member Posts: 43
Hi,
We moved our historical sales orders to a second table. (T50000 "Sales Header History" and T50001 "Sales Line History").
Don't ask why ...
To find a order the users have to try now on two different Forms (open & historical) when performing a search.
On the Form "Sales Order" I would like to implement an improved search functionality.
The user searches for a sales order by clicking into the field "No." and then Ctrl-F.
If the search fails the search should continue in T50000.
Given there is a record, I would open the relevant Form for T50000 and T50001.
Any ideas how to implement this?
I tried to catch the CurrFieldNo and use it in the OnFindRecord Trigger of the Form, but this is too late in the process.
Thanks,
Martin
We moved our historical sales orders to a second table. (T50000 "Sales Header History" and T50001 "Sales Line History").
Don't ask why ...
To find a order the users have to try now on two different Forms (open & historical) when performing a search.
On the Form "Sales Order" I would like to implement an improved search functionality.
The user searches for a sales order by clicking into the field "No." and then Ctrl-F.
If the search fails the search should continue in T50000.
Given there is a record, I would open the relevant Form for T50000 and T50001.
Any ideas how to implement this?
I tried to catch the CurrFieldNo and use it in the OnFindRecord Trigger of the Form, but this is too late in the process.
Thanks,
Martin
0
Comments
-
If i understand to your issue, you can use something like this:
SearchCity := City;
PostCodeRec.SETCURRENTKEY("Search City");
PostCodeRec.SETFILTER("Search City",SearchCity);
FORM.RUN(FORM::"Pay Post Codes",PostCodeRec,PostCodeRec.Code)
Of course you must use different fields, filters, form.0 -
Well, I have to ask: "Why didn't you use the standard archive tables?"
When the decision was made to move the data to some "special" tables, the consequences (e.g. searching) of doing so must have been considered as well!?0 -
Did you have a look at the Where-Used feature for G/L Accounts?0
-
Hi all,
thanks for your answers and thanks to Luc to point out a feature I did not know yet :-)
The problem is not how to do the search and open the Form afterwards.
The issue is to make it most comfortable.
A additional button in the form or assist-edit would do, but I try for a better solution.
If the record is not found in table 36 then I would like to continue in table 50000 and if found there open the forms for 50000 and 50001.
Best if using Ctrl-F search.
Any ideas?0 -
MartinFK wrote:Hi,
We moved our historical sales orders to a second table. (T50000 "Sales Header History" and T50001 "Sales Line History").
Don't ask why ...
OK so we can't ask why? But surely its not to late to fix it. Just move the data to the correct tables and do it properly.David Singleton0 -
MartinFK wrote:The issue is to make it most comfortable.MartinFK wrote:If the record is not found in table 36 then I would like to continue in table 50000 and if found there open the forms for 50000 and 50001.MartinFK wrote:Best if using Ctrl-F search.MartinFK wrote:Any ideas?0
-
I've added a search feature that might be similar to what you are looking for.
Sometime going into Posted Invoices and filtering on orders takes a minute or two.
If you have as many Posted Invoices as us 2003-2012 and you see "Searching Records or Reading Records" message for a while.
So I wanted something instant. So I made a form called "Quick Find Orders" and it's basic function is that you enter a external doc number and it will find it if it's in either the Sales Orders or the Posted Invoices.
Now this is specific to our business need perhaps you can use something like this to search multiple tables but that's a bandaid I think in your situation.
It finds it instantly and opens the form!
You can add more setranges if needed like the cust no.
If you are looking for the "No" field - then use that as your setcurrent key!
We needed to look up external doc - that's why I used the key I did.
I will also assume you created the same or similar keys in your "History Tables"
SalesHeader -> Record -> Sales Header (Table1)
SalesInvoiceHeader -> Record -> Sales Invoice Header (Table2)
OrderNo -> Code20
SalesForm -> Form -> Sale Order
InvoiceForm -> Form -> Posted Sales InvoiceOnAfterValidate() IF OrderNo = '' THEN BEGIN MESSAGE('You Cannot Search A Blank Number!'); END ELSE BEGIN SalesHeader.SETCURRENTKEY("Sell-to Customer No.","External Document No."); SalesHeader.SETRANGE("External Document No.",OrderNo); IF SalesHeader.FIND('+')THEN BEGIN MESSAGE('Open Order Found'); CLEAR(SalesForm); SalesForm.LOOKUPMODE(TRUE ); SalesForm.SETTABLEVIEW(SalesHeader); SalesForm.RUNMODAL; CLEAR(OrderNo); END ELSE BEGIN SalesInvoiceHeader.SETCURRENTKEY("Sell-to Customer No.","External Document No."); SalesInvoiceHeader.SETRANGE("External Document No.",OrderNo); IF SalesInvoiceHeader.FIND('+')THEN BEGIN MESSAGE('Posted Order Found'); CLEAR(InvoiceForm); InvoiceForm.LOOKUPMODE(TRUE ); InvoiceForm.SETTABLEVIEW(SalesInvoiceHeader); InvoiceForm.RUNMODAL; CLEAR(OrderNo); END ELSE BEGIN MESSAGE('Order Not Found'); CLEAR(OrderNo); CurrForm.UPDATE; END; END; END;
0 -
Hello Savatage,
I was thinking about the solution you have described but wanted to avoid an additional Form that needs to be opened.
The idea was to add this C/AL code at a place, where Navision ends when the search (Ctrl-F) fails.
That was the reason I asked.
And it seems that your Form solution will be the way to go.
@the others, regarding the "don't ask why"
I inherited this functionality from my successor and it not an option to change it. If I could only get rid of it ..... but this is a political decision. It is similar to the Archived Orders, but with some (important) differences. And in my opinion it is heavily redundant with the combination of Invoices and Archive. A lot of processes build on the existance of this specific tables.
Thanks for your replies.0 -
MartinFK wrote:The idea was to add this C/AL code at a place, where Navision ends when the search (Ctrl-F) fails.
Moving the old invoices to a new location also killed the navigate function from the customer ledger entries too
FYI:;
It doesn't have to be a new form you can add a textbox to any already made form.
A form that makes sence to why it's there.
You'll have to change some of the search criteria to fit your needs.
My form looks as below. You only need 1 Textbox to enter a number into and put the code OnAfterValidate.
When you're doing 60,000 orders a month - I'll take all the help I can get managing orders, answering questions
This solution for us was not ment to be used for your type of problem but I see where it can help you, if you don't want to move the data back to proper tables.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