Lookup Problem

KSP_NAV
Member Posts: 68
Hi,
The below coding is written in the "OnLookup" trigger of the table X. The problem is the value is not getting updated in the field but it is displayed in the message.
LGenJnlTemplate.RESET;
LGenJnlTemplate.SETRANGE(LGenJnlTemplate.Recurring,TRUE);
CASE LGenJnlTemplate.COUNT OF
1: BEGIN
LGenJnlTemplate.FINDFIRST;
LGenJnlBatch.RESET;
LGenJnlBatch.SETRANGE(LGenJnlBatch."Journal Template Name",LGenJnlTemplate.Name);
LFrmGenJnlBatches.SETTABLEVIEW(LGenJnlBatch);
LFrmGenJnlBatches.SETRECORD(LGenJnlBatch);
LFrmGenJnlBatches.LOOKUPMODE(TRUE);
IF LFrmGenJnlBatches.RUNMODAL IN [ACTION::OK, ACTION::LookupOK] THEN BEGIN
LFrmGenJnlBatches.GETRECORD(LGenJnlBatch);
"Rec. Journal Batch" := LGenJnlBatch.Name;
MESSAGE(LGenJnlBatch.Name);
END;
END;
2:
.
.
END;
CLEAR(LFrmGenJnlBatches);
The same set of codes works fine in the Form but in my case it should work in table.
Can anyone help me to sort this problem?
Thanks in advance
The below coding is written in the "OnLookup" trigger of the table X. The problem is the value is not getting updated in the field but it is displayed in the message.
LGenJnlTemplate.RESET;
LGenJnlTemplate.SETRANGE(LGenJnlTemplate.Recurring,TRUE);
CASE LGenJnlTemplate.COUNT OF
1: BEGIN
LGenJnlTemplate.FINDFIRST;
LGenJnlBatch.RESET;
LGenJnlBatch.SETRANGE(LGenJnlBatch."Journal Template Name",LGenJnlTemplate.Name);
LFrmGenJnlBatches.SETTABLEVIEW(LGenJnlBatch);
LFrmGenJnlBatches.SETRECORD(LGenJnlBatch);
LFrmGenJnlBatches.LOOKUPMODE(TRUE);
IF LFrmGenJnlBatches.RUNMODAL IN [ACTION::OK, ACTION::LookupOK] THEN BEGIN
LFrmGenJnlBatches.GETRECORD(LGenJnlBatch);
"Rec. Journal Batch" := LGenJnlBatch.Name;
MESSAGE(LGenJnlBatch.Name);
END;
END;
2:
.
.
END;
CLEAR(LFrmGenJnlBatches);
The same set of codes works fine in the Form but in my case it should work in table.
Can anyone help me to sort this problem?
Thanks in advance
0
Comments
-
Hi,
first impression to me is that a "MODIFY" is missing to save the new value in the table...0 -
Hi,
Thanks for your reply.
I have already tried with MODIFY and the new value is not updated0 -
-
Nope, have a look in the "Applies-to Doc. No." etc... fields in table 360
-
Is there any possibilities for my query? As i am running out of time, can anyone help me in this regard?0
-
Hi,
What is "Rec. Journal Batch" is this a record variable or a field name of the table you are trying to update?
maybe it should be "Rec. Journal Batch".Name := LGenJnlBatch.Name;
Hope this helps0 -
"Rec. Journal Batch" is a field in which i need to update the General Journal Batch Name.
After the field assignment, if i message the "Rec. Journal Batch" field, it is displaying the desired output. The problem is that the value is not updated in the table.
"Rec. Journal Batch" := LGenJnlBatch.Name;
MESSAGE("Rec. Journal Batch");0 -
What kind of type is your field "Rec. Journal Batch"?0
-
It is Code 100
-
So this should be updated if modified. As I first replyed I think a modify-command must be to save the modified value in table. Only idea is to check if there's any other following code which will rollback your modification after having displayed it. Is the code you provided us the whole code in that trigger? Did you debug it to check step by step when field value changes?
If there's more code which is done you may provide it... maybe anyone in this forum then has a good idea...0 -
How have you tried? Run the table? If so try to use any form. NAV has a problem with written lookup in the field when use run table.
Do not use modify in lookup.0 -
Thanks Daros, as you said i have been trying this only at the table level and now i created a Form and performed the lookup and it works as expected.
Thank you everyone for your timely help.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