Filter Item Form by Sales Lines
erugalatha
Member Posts: 120
Hi,
I'm showing a custom form from a drill down on the shipping tab of a Sales Order. On this Custom form I have the Item Code which is linked back to the item table.
When the custom form is displayed and I lookup on this Item Code is it possible to show only Items that are currently on the Sales Lines of the Sales Order?
I'm showing a custom form from a drill down on the shipping tab of a Sales Order. On this Custom form I have the Item Code which is linked back to the item table.
When the custom form is displayed and I lookup on this Item Code is it possible to show only Items that are currently on the Sales Lines of the Sales Order?
0
Comments
-
Yes, but you will have to do some programming.
I think the easiest is to create a singleinstance-codeunit with a temptable in T27:"item".
When calling the custom form, first you have to fill up the temptable in the codeunit with the items on your sales order.
When you do a lookup on the item list, you have to check if there are items in the temptable of the codeunit. If there are, mark those records in the OnOpenForm of the item list, and do a MARKEDONLY.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
ok thanks for replying.
I've created the codeunit and the temptable item but I'm not sure how to fill the temptable with items on my sales lines.
Could you help further please?0 -
Hi! I have done something similar to this all you have to do is:
1. pass the document no. of the Sales order to the custom form.
2. use the document no. to filter a sales line record variable.
3. filter the sales line record variable again to remove lines that are not items.
4. fill up a temporary item table using all the items in sales line. like this
REPEAT
item.GET(salesline."No.");
tempitem := item;
tempitem.INSERT;
UNTIL salesline.NEXT = 0;
5. when doing a lookup use
FORM.RUNMODAL(FORM::"Item List",tempitem);
hope that helps
0 -
ok, I've done steps 1., 2., 3., 4., and 5 but when I try to lookup a second time by pressing the Item No. lookup on my custom form I get an error message saying:
Item No. 'LS-75' already exists.
It happens for any item - do I need to clear the tempItem table?
Also when the Item List appears there are no OK and Cancel buttons - how do I make the list so that I can select one of the items on it and it will return that item no. into the item no. on my custom form?
Sorry for all the questions but I think I am nearly there on this one.
0 -
sorry i just thought of the solution without actually coding it. you need to clear (use deleteall) tempitem table before populating it.
did you use FORM.RUNMODAL? it should have OK and CANCEL buttons.0 -
Use:mightykid wrote:sorry i just thought of the solution without actually coding it. you need to clear (use deleteall) tempitem table before populating it.
did you use FORM.RUNMODAL? it should have OK and CANCEL buttons.IF FORM.RUNMODAL(...) = ACTION::LookUpOK THEN BEGIN END;
There is some strange thing in this code. It seems that the "ACTION::LookUpOK" is send to the form so the form can act upon it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks a lot for your help both of you. \:D/
There's one thing happening though that seems strange - when I select an item from the list on the Item List it does not return that Item back into my custom form Item No. field.
Do I need to do something within the IF statement below to make this happen?IF FORM.RUNMODAL(...) = ACTION::LookUpOK THEN BEGIN END;
0 -
CLEAR(recSomeRecord);
// you can also put some filters on the record or give an initial record to position on
IF FORM.RUNMODAL(FORM::"The Form",recSomeRecord) = ACTION::LookUpOK THEN BEGIN
codSomeField := recSomeRecord."Some Field";
END;Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi,
I just had a problem here where I need to make sure that I don't try to add the same item twice to the temporary table. e.g. on some sales orders the same item no. will appear more than once (but with different variants) this means when I loop over the Sales Lines to create my temporary table I get the error that the item already exists if there's more than one sales line with the same item no.
Any ideas how to check what's already in the temp. table before adding?
thanks for any help0 -
with reference to mightykid's code, instead of using
tempitem.insert
useif tempitem.insert then ;
0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions