COMMIT; GenJnlBatch."Journal Template Name" := GenJnlLine.GETRANGEMAX("Journal Template Name"); GenJnlBatch.Name := GenJnlLine.GETRANGEMAX("Journal Batch Name"); GenJnlBatch.FILTERGROUP := 2; GenJnlBatch.SETRANGE("Journal Template Name",GenJnlBatch."Journal Template Name"); GenJnlBatch.FILTERGROUP := 0; IF FORM.RUNMODAL(0,GenJnlBatch) = ACTION::LookupOK THEN BEGIN CurrentJnlBatchName := GenJnlBatch.Name; SetName(CurrentJnlBatchName,GenJnlLine); END;
Comments
So with SETRANGE(Var, 1, 5) the GETRANGEMAX command will always return 5.
My Blog - nav.education
GenJnlBatch."Journal Template Name" := GenJnlLine.GETRANGEMAX("Journal Template Name");
My Blog - nav.education
Same approach:
SETRANGE("Journal Template Name", 'AAA);
GETRANGEMAX("Journal Template Name") -> 'AAA'
SETRANGE("Journal Template Name", 'AAA,'ZZZ')
GETRANGEMAX("Journal Template Name") -> 'ZZZ'
SETRANGE("Journal Template Name", 'ZZZ', 'AAA')
GETRANGEMAX("Journal Template Name") -> 'AAA'
It has nothing to do with field values existing in the underlying table, or sorting order. It just returns 'upper' value of range FILTER set on the field.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03