Problem in Lookup
mrigya
Member Posts: 124
Hi all
Please tell me how can put a look on the field which is not the primary key.
Thanks
Mrigya
Please tell me how can put a look on the field which is not the primary key.
Thanks
Mrigya
0
Comments
-
??? Sometimes more background infos are good ....
do you use the TableRelation property in a table and there comes the error or what?Do you make it right, it works too!0 -
For instance by using LookUpOK.
In OnLookUp trigger of the field, you can try this kind of code :SourceTable.RESET; SourceTable.SETFILTER(Field1,'%1',Filter1); IF FORM.RUNMODAL(Form ID,,SourceTable) = ACTION::LookupOK THEN "My Field" := SourceTable."Source Field";
My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
when i have used the tablerelation properties then system generate the error Msg.
Error Msg is:-
The field below must be included in the table's primary key.
field:- External document no.
table: Cust. Ledger Entry0 -
So, the table relation prop. is for PK fields.
so if you need the table relation and an lookup to an other field in the relat. Table, use the OnLookup Trigger of the field.Do you make it right, it works too!0 -
I m using the table relation properties but system generate the error.0
-
And LookUpOK ?? Does it work ?My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
No,Actually the source table field is not a primary value.so system generate the error.0
-
But the LookUpOK function works even if the field is not included in the primary key.
Try this :
Create a form based on Integer, Create a var TestVarDec (Decimal).
Add a control on your form which Source is this TestVarDec.
On your control, on trigger "OnLookup(VAR Text : Text[1024]) : Boolean"
Write the next code (GLEntry is a record var based on table 17.GLEntry.RESET; IF FORM.RUNMODAL(20,GLEntry) = ACTION::LookupOK THEN TestVarDec := GLENtry.Amount;
I just tried, it works fineMy candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
Hi Mrigya,
take a textbox with Source Expression CustName
<YourControl> - OnLookup(VAR Text : Text[1024];) : Boolean
global variables
CustName --- Code --- 50
CustRec --- Record --- Customer
CustFrm --- Form --- Customer ListCustRec.RESET; // CustRec.SETRANGE("Your Field",FromValue,ToValue); // to set filter on lookup form IF CustRec.FINDSET THEN BEGIN CustFrm.SETTABLEVIEW(CustRec); CustFrm.LOOKUPMODE(TRUE); IF CustFrm.RUNMODAL = ACTION::LookupOK THEN BEGIN CustFrm.GETRECORD(CustRec); CustName := CustRec.Name; END; END; CLEAR(CustFrm);
I hope, you got the Idea...!! O:)Sandeep Prajapati
Technical Consultant, MS Dynamics NAV0
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