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
0
Comments
first impression to me is that a "MODIFY" is missing to save the new value in the table...
Thanks for your reply.
I have already tried with MODIFY and the new value is not updated
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 helps
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");
If there's more code which is done you may provide it... maybe anyone in this forum then has a good idea...
Do not use modify in lookup.
Thank you everyone for your timely help.