how to skip dataitem

charles.rooscharles.roos Member Posts: 60
How to skip dataitem?
I tried to put skipping into OnPreDataItem-trigger with putting data excluding filter (1..-1) on the dataitem, i tried both filtergroups 0 and 2, i think, and still dataitem is processed, GLEntryEmptyGD1C - OnAfterGetRecord() is executed. How to skip dataitem then?

GLEntryEmptyGD1C - OnPreDataItem()

IF GLEntryForCopyingFilters.GETFILTER("Global Dimension 1 Code") <> '' THEN BEGIN
//don't show GLEntryEmptyGD1C, don't show IntegerEmptyGD1cALG0
GLEntryEmptyGD1C.SETRANGE(GLEntryEmptyGD1C."Entry No.",1,-1);//don't show data item
SkipIntegerEmptyGD1cALG0 := TRUE;
EXIT;
END;

Comments

  • ErictPErictP Member Posts: 164
    Try CurrReport.SKIP
  • charles.rooscharles.roos Member Posts: 60
    ErictP wrote:
    Try CurrReport.SKIP

    I tried, it doesn't work.
    CurrReport.SKIP is used only in "OnAfterGetRecord"-trigger, in no other trigger. My porpouse is to avoid going to "OnAfterGetRecord"-trigger at all, so i suggest to use "OnPreDataItem"-trigger, but how?
  • AlbertvhAlbertvh Member Posts: 516
    Hi
    if this is an indented dataitem you could use CurrReport.BREAK;



    Albert
  • charles.rooscharles.roos Member Posts: 60
    Albertvh wrote:
    Hi
    if this is an indented dataitem you could use CurrReport.BREAK;

    Albert

    Are you sure this is right instruction to ignore dataitem?
    I understand it stops only execution of next lines in a trigger-function, but still the data item is walked through, AfterRecord-trigger would run as many times as there is data records. The better would be to somehow tell something like:
    DataItem.MaxIteration = 0;


    BREAK (Dataport, Report, XMLport)
    Use this function to exit from a loop or a trigger in a data item trigger of a dataport, report or XMLport.
  • ara3nara3n Member Posts: 9,255
    Yes it's currreport.break
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SobyOneSobyOne Member Posts: 20
    CurrReport.Break is the correct command for skipping a data item (generally) once you are in the OnAfterGetRecord();

    You can also create an unreasonable filter in the OnPreDataItem() which will cause the OnAfterGetRecord() to be skipped.

    The only problem using CurrReport.Skip is that it must be in the OnAfterGetRecord() section and you will still be reading the data from the server, which consumes network bandwidth.

    When in doubt, choose:
    GLEntryEmptyGD1C - OnPreDataItem()
    IF GETFILTER("Global Dimension 1 Code") <> '' THEN
    CurrReport.Break;

    Note the change to NOT indicate the data item. It's implied and sometimes helps when debugging because property changes on the dataitem (the name of the data item) will break a fully qualified line of code.
    _\~ () ]3 `/ () |\| [-
    http://www.SobyLand.com
    651-815-0698
Sign In or Register to comment.