Show record list from a different company

Djou2424
Member Posts: 76
Hi,
I need help for one of our client.
We need to show the location list from a different company, in a form, and retrieve the record selected by the user into in a field.
Here is what I tried, but it is always showing me the location list of my current company.
recLoc.RESET; //record Location Code, temporary NO
CLEAR(frmLoc); // form Location List
CLEAR(tmpLoc);
tmpLoc.DELETEALL; //record Location Code, temporary YES
recLoc.CHANGECOMPANY("Company Name");
IF recLoc.FIND('-') THEN
REPEAT
tmpLoc := recLoc;
tmpLoc.INSERT;
UNTIL recLoc.NEXT = 0;
frmLoc.SETTABLEVIEW(tmpLoc);
IF frmLoc.RUNMODAL = ACTION::LookupOK THEN
BEGIN
frmLoc.GETRECORD(tmpLoc);
"Location Code" := tmpLoc.Code;
END;
What am I doing wrong?
Thanks
-Julie
P.S: I also tried setting the form view to the recLoc directly instead of the temporary table, same results.
I need help for one of our client.
We need to show the location list from a different company, in a form, and retrieve the record selected by the user into in a field.
Here is what I tried, but it is always showing me the location list of my current company.
recLoc.RESET; //record Location Code, temporary NO
CLEAR(frmLoc); // form Location List
CLEAR(tmpLoc);
tmpLoc.DELETEALL; //record Location Code, temporary YES
recLoc.CHANGECOMPANY("Company Name");
IF recLoc.FIND('-') THEN
REPEAT
tmpLoc := recLoc;
tmpLoc.INSERT;
UNTIL recLoc.NEXT = 0;
frmLoc.SETTABLEVIEW(tmpLoc);
IF frmLoc.RUNMODAL = ACTION::LookupOK THEN
BEGIN
frmLoc.GETRECORD(tmpLoc);
"Location Code" := tmpLoc.Code;
END;
What am I doing wrong?
Thanks
-Julie
P.S: I also tried setting the form view to the recLoc directly instead of the temporary table, same results.
0
Comments
-
Try tmpLoc.changecompany("company name") before copying the records to temp variable0
-
The probelm is that you are using SETTABLEVIEW. It is passing only filters, not the record itself.
Try to do it easily:Loc.CHANGECOMPANY("another company"); IF FORM.RUNMODAL(0,Loc) = ACTION::LookupOK THEN BEGIN "Location Code" := Loc.Code; END;
You even do not need to use temporary table...0 -
kine wrote:The probelm is that you are using SETTABLEVIEW. It is passing only filters, not the record itself.
Try to do it easily:Loc.CHANGECOMPANY("another company"); IF FORM.RUNMODAL(0,Loc) = ACTION::LookupOK THEN BEGIN "Location Code" := Loc.Code; END;
You even do not need to use temporary table...
Thank you very much, it's working0
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