Use Marked Only In a Report

tompynationtompynation Member Posts: 398
Hi, i created a report with following DataItems:

DataItem Name
Item Category <Item Category>
---Product Group <Product Group>
Item <Item>
Price Group <Price Group>
---Kleur Toeslag <Kleur Toeslag>
---Bindmiddel Toeslag <Bindmiddel Toeslag>
---Verpakking <Verpakking>

Now the Problem is that this report is now Printing every record from the "Kleur Toeslag", "Bindmiddel Toeslag" & "Verpakking"

But this isnt the desired functionality. I need to print only the
"Kleur Toeslag", "Bindmiddel Toeslag" & "Verpakking"
if there are items under the "Product Group" who uses one of this records.

This is how i try to solve this:
Report - OnInitReport()
CLEAR(gv_KleurToeslag);
CLEAR(gv_BindmiddelToeslag);
CLEAR(gv_VerpakkingToeslag);

"Kleur Toeslag".CLEARMARKS;
"Bindmiddel Toeslag".CLEARMARKS;
Verpakking.CLEARMARKS;

Then in the Item onAfterGetRecord:
I place marks if the "Kleur Toeslag" or the "Bindmiddel Toeslag" or the "Packing Type" has been filled in.
Item - OnAfterGetRecord()
   // Check of er een Kleurtoeslag aan het Artikel hangt:
      IF "Kleur Toeslag" <> '' THEN BEGIN
         IF gv_KleurToeslag.GET("Kleur Toeslag") THEN
            gv_KleurToeslag.MARK(TRUE);
      END;

   // Check of er een Bindmiddeltoeslag aan het Artikel hangt:
      IF "Bindmiddel Toeslag" <> '' THEN BEGIN
         IF gv_BindmiddelToeslag.GET("Bindmiddel Toeslag") THEN
            gv_BindmiddelToeslag.MARK(TRUE);
      END;

   // Check of er een Verpakkingtoeslag aan het Artikel hangt:
      IF "Packing Type" <> '' THEN BEGIN
         IF gv_VerpakkingToeslag.GET("Packing Type") THEN
            gv_VerpakkingToeslag.MARK(TRUE);  
      END;

Then i copy this mark filter to my DataItems:
Kleur Toeslag - OnPreDataItem()
"Kleur Toeslag".COPYFILTERS(gv_KleurToeslag);
"Kleur Toeslag".MARKEDONLY(TRUE);

But now it isnt printing any record? Before i added the mark coding it was printing all records from the table "Kleur Toeslag"
Now it isnt printing any record anymore?

Does the COPYFILTERS dont copy the marks?

Answers

  • i4tosti4tost Member Posts: 208
    Mark is not a filter, it is a temporary value for record, so this function will not copy marks.
    Mark dataitem records, do not create variable
  • tompynationtompynation Member Posts: 398
    Allright, i marked the dataitem now... but the report is still not showing the marked ones. It show none of them now

    DataItems:
    DataItem Name
    Item Category <Item Category>
    ---Product Group <Product Group>
    Item <Item>
    Price Group <Price Group>
    ---Kleur Toeslag KleurToeslag
    ---Bindmiddel Toeslag BindmiddelToeslag
    ---Verpakking <Verpakking>

    Here is how i mark the DataItems:
    Item - OnAfterGetRecord()
    IF Item."Price Group" = '' THEN
       CurrReport.SKIP
    ELSE BEGIN
       // Check of er een Kleurtoeslag aan het Artikel hangt:
          IF Item."Kleur Toeslag" <> '' THEN BEGIN
             IF KleurToeslag.GET(Item."Kleur Toeslag") THEN
                KleurToeslag.MARK(TRUE);
          END;
    
       // Check of er een Bindmiddeltoeslag aan het Artikel hangt:
          IF Item."Bindmiddel Toeslag" <> '' THEN BEGIN
             IF BindmiddelToeslag.GET("Bindmiddel Toeslag") THEN
                BindmiddelToeslag.MARK(TRUE);
          END;
    
       // Check of er een Verpakkingtoeslag aan het Artikel hangt:
          IF Item."Packing Type" <> '' THEN BEGIN
             IF Verpakking.GET(Item."Packing Type") THEN
                Verpakking.MARK(TRUE);
          END;
    END;
    

    Set the Marked filter for one dataitem:
    KleurToeslag - OnPreDataItem()
    KleurToeslag.MARKEDONLY(TRUE);
    

    When i follow with the debugger, i see that some records are getting marked... So it looks like it that when
    i reach the DataItems, that the marks have disappeared ?
  • AlbertvhAlbertvh Member Posts: 516
    Hi
    Why don't you indent the 3 dataitems and link them to the Item?
    DataItem Name
    Item Category <Item Category>
    ---Product Group <Product Group>
    ------Item <Item>
    ------Price Group <Price Group> 
    --------Kleur Toeslag KleurToeslag (DataItemLink Reference-Item
                                                     DataItemLink - No.=FIELD(Kleur Toeslag)
    --------Bindmiddel Toeslag BindmiddelToeslag
    --------Verpakking <Verpakking>
    

    Hope this helps

    Albert
  • tompynationtompynation Member Posts: 398
    because they are not linked to the Item, but to the Item Category

    I have to show all the "Kleur Toeslag" & "Bindmiddel Toeslag" & "Verpakking" at the end of each Item Category...

    But i can only show the Records from these DataItems which are used by an Item inside the Item Category Code
  • i4tosti4tost Member Posts: 208
    Actually i will recomend you do not use mark, because this filtering is VERY slow and takes 100% of processor. Better way (if it is possible) is to use temporary table. In that case you can insert your table record in your table temporary table and then use Integer dataitem to print.
  • tompynationtompynation Member Posts: 398
    but the mark functionallity is totally not working...

    Guess there will be no other choice then using a Temp Table or unless someone can tell me why the mark functionallity is not working
  • AlbertvhAlbertvh Member Posts: 516
    Hi,
    You MARK is not working because you probably have the property set to link to the Product Group dataitem, you should use an integer dataitem.

    Could you give more info on what field you are trying to show at the end of the Product Group from these dataitem.
    If you are just counting the records then the easiest would be to use a CREATETOTALS in the OnPreDataitem of the Product Group and the Item dataitems.


    Albert
  • tompynationtompynation Member Posts: 398
    Allright... I decided to forget the mark functionallity and solved it by using a tempory
    record.

    Got it working like it should now.
    Thanks for the info
Sign In or Register to comment.