Options

How to do a specific SETRANGE

iqbalmadiqbalmad Member Posts: 179
hi guys:

can you tell me how to proceed

i have to do a SETRANGE which is like zis in pseudocode in a FORM

GLEntry.SETRANGE(G/L Account No.,VAR1)
var1=GLAccount.Code Where GLAccount.Account Type = 1

Comments

  • Options
    ara3nara3n Member Posts: 9,256
    All the records in GLentry have a glaccount where account type is 1 so. It's all the entries in GL. The rest of gl account do not create glentry

    Posting,Heading,Total,Begin-Total,End-Total

    Did you mean zero? for Posting, or Heading? option feilds start at zero. and zero is for Posting.1 is heading.
    and headings do not have any glentry.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    David_CoxDavid_Cox Member Posts: 509
    iqbalmad wrote:
    hi guys:

    can you tell me how to proceed

    i have to do a SETRANGE which is like zis in pseudocode in a FORM

    GLEntry.SETRANGE(G/L Account No.,VAR1)
    var1=GLAccount.Code Where GLAccount.Account Type = 1

    There are only postings for GLAccount."Account type"::Posting in the G/L Entry Table, but if it is the G/L Account table you mean?

    Setrange is like a SELECT statement
    So you want
    GLAccount.SETRANGE("Account Type",GLAccount."Account type"::Posting);
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • Options
    ara3nara3n Member Posts: 9,256
    My guess David
    He probably just wants to see the gl entries for Total GLaccounts only,
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    The general idea of modelling 1:N relationships (typical LEFT JOIN's) is with nested loops:
    CLEAR(recordA);
    CLEAR(SomeTotalOfRecordB);
    recordA.SETCURRENTKEY("SomeField");
    recordA.SETRANGE("SomeField", 'somevalue');
    IF recordA.FIND('-') THEN REPEAT
       CLEAR(recordB);
       recordB.SETCURRENTKEY("recordA No.");
       recordB.SETRANGE("recordA No.",recordA."No.");
       if recordB.FIND('-') THEN REPEAT
           SomeTotalOfRecordB += recordB."SomeAmountField";
       UNTIL recordB.NEXT=0;
    UNTIL recordA.NEXT=0;
    
  • Options
    ara3nara3n Member Posts: 9,256
    Yes Miklos but he wants to see that in a form. I guess he could write it into a temp table and display that. But it's going to be very slow.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    For showing it on a form, I have a download for that:

    http://mibuso.com/dlinfo.asp?FileID=515
Sign In or Register to comment.