Options

Get the same record from first DataItem after loop

DSDS Member Posts: 4
Is is possible, after processing all the DataItems in a report, to start with the same record from the first DataItem again. Let me explain this a little bit more:

First DataItem
record 1
record 2
-Second DataItem
-record 1
-record 2
--Third DataItem
--record 1
--record 2

The Report starts with the First DataItem and record1 then goes to the Second DataItem etc. After the Third DataItem I would like to go to record 1 again from the first DataItem. Is this possible yes/no.

I can solve my problem, using an array or temp table, but I want it like described above.

Thanks in advance for reading and posting an answer.

Comments

  • Options
    DenSterDenSter Member Posts: 8,304
    Sure, just create three dataitems based on the same table and with the same filter criteria as the first one. Set the key of the second and third dataitems so the user doesn't see them, so you only get filters on one of them. You then simply copy the filters from the first to the second to the third as you process them.
  • Options
    kinekine Member Posts: 12,562
    what about this???

    First DataItem - Loop (Integer)
    First' DataItem
    record 1
    record 2
    -Second' DataItem
    -record 1
    -record 2
    --Third' DataItem
    --record 1
    --record 2

    If you will filter the First dataitem (loop) for example SETRANGE("No.",1,3) it will execute your report 3-times...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    DenSterDenSter Member Posts: 8,304
    Right that's the advanced option Kine :) for us geeks only 8)
  • Options
    DSDS Member Posts: 4
    Kine, do you mean using the Integer (virual) table as the first DataItem. It seems to work quite well. I haven't finished my project yet, but with this hint it seems to come to an end.
    DenSter, thanks for your answer too. I'll keep you guys updated and will post my answer here. Maybe usefull for somebody else.
  • Options
    DenSterDenSter Member Posts: 8,304
    Just out of curiosity.... why not do this:
    Dataitem1
    Record 1
    Do everything you need to do
    Record 2
    Do everything you need to do

    Why loop through the same records more than once?
  • Options
    DSDS Member Posts: 4
    I use five different DataItems like this:
    DI1
    -DI2
    --DI3
    -DI4
    --DI5

    In DI3 and DI5 I have to do a summation and when the answer exceeds a given amount, I have to print data from all the dataitems, if the answer doesn't exceed the given amount I don't wanna print that part. The flowcharts are telling me that printing almost occurs 'real time' and I don't see a possible way (without a loop, array, temp table...) to print all the preceding DI sections after reaching the end of DI5.

    So, in the first case i'll loop the process again (the first run there is never a print --> SHOWOUTPUT(FALSE)) and start printing immediately, because I know the answere will exceed a given amount and in case two i'll go to the next record in DI1.

    I hope this will explain a bit more and maybe it'll trigger some smart answers too;) My 'problem' is a lack of documentation and real life examples from users like you have when programming in Java etc. The learning curve is quite steep because you have to reinvent the wheel again sometimes. BTW, I'm hacking Navision for three weeks now.
Sign In or Register to comment.