Processing Report

sarmigsarmig Member Posts: 89
Hi there.

I was assigned a new task. I have to write a processing-only report. From what I could tell, a processing report is like a batch file, which runs a few tasks on the background.

It shouldn't be too hard. Basically, I have to check values from a field of a table, and if the content of that field is 0, it should copy values from a field from another table, obviously bearing in mind that the selected item of those two tables must be the same one.

Ok, so, if you could give me some pointers about where should I start, it would be great. I wish there was a beginner's forum for these rookie questions, but I guess this is the place where the experts are...

Thanks in advance!

Comments

  • matttraxmatttrax Member Posts: 2,309
    You should start by reading the reporting documentation. If you are a customer, check CustomerSource. If you are a partner check PartnerSource.
  • sarmigsarmig Member Posts: 89
    Ok, so this is what I have until now (obviously it doesn't work...yet):
    RecItem.RESET;
    RecRoutingLine.RESET;
    
    RecItem.SETRANGE("No.", 'M000000', 'M999999');
    IF RecItem.FINDFIRST() THEN BEGIN
      REPEAT
        IF RecItem."Tempo Fabrico Machos" > 0 THEN BEGIN
          RecRoutingLine."Run Time" := RecItem."Tempo Fabrico Machos";
          RecRoutingLine.MODIFY;
          MESSAGE('%1', RecRoutingLine."Run Time");
          RecItem.NEXT;
        END
      UNTIL RecItem."No." = 'M999999';
    END
    

    What I want is to filter only the items that begin with the letter 'M', then if those items have a certain field > 0, I want that value to be copied to another table, but on the same item...

    I tried doing it alone, with what I know until now, but I was hoping you could point me in the right direction...

    Thanks...
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    RecItem.RESET;
    RecRoutingLine.RESET;
    
    RecItem.SETRANGE("No.", 'M000000', 'M999999');
    IF RecItem.FINDSET THEN
      REPEAT
        IF RecItem."Tempo Fabrico Machos" > 0 THEN BEGIN
          RecRoutingLine."Run Time" := RecItem."Tempo Fabrico Machos";
          RecRoutingLine.MODIFY;
          MESSAGE('%1', RecRoutingLine."Run Time");
          
        END
      UNTIL RecItem.Next = 0;
    

    Do you have right RecRoutingLine record at that point?
  • sarmigsarmig Member Posts: 89
    Its showing an error that says something like this (I'm translating from the portuguese, so it might not say the same in English): "It's not possible to make any changes in the database until a transaction is initiated"...
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Do you have right RecRoutingLine record at that point?

    Did you check this?
  • sarmigsarmig Member Posts: 89
    I was pointed to the right direction: they told me to eliminate the repeat...until and to write the code in the OnAfterGetRecord trigger(I'm using the Item Data Item, but I'm not sure if I should be using the Routing Line Data Item).

    I'm sure I'm almost there. Here's what I've got:
    RecItem.RESET;
    RecRoutingLine.RESET;
    
    RecItem.SETFILTER("No.", 'M*' );
    RecRoutingLine.SETFILTER("Routing No.", 'M*');
    
    IF RecItem.FIND AND RecRoutingLine.FIND THEN
        IF RecItem."Tempo Fabrico Machos" > 0 THEN BEGIN
          RecRoutingLine."Run Time" := RecItem."Tempo Fabrico Machos";
          RecRoutingLine.MODIFY;
        END
    
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    If you are using Item Dataitem then no need to take recItem variable..
    Set M* in DataItemTableView-Talbe Filter

    In Onaftergetrecord trigger write this
    RecRoutingLine.RESET;
    RecRoutingLine.SETRANGE("Routing No.","No.");
    IF RecRoutingLine.FINDSET THEN
    REPEAT
    IF "Tempo Fabrico Machos" > 0 THEN BEGIN
    RecRoutingLine."Run Time" := "Tempo Fabrico Machos";
    RecRoutingLine.MODIFY;
    END
    UNTIL RecRoutingLine.NEXT = 0;
  • sarmigsarmig Member Posts: 89
    If you are using Item Dataitem then no need to take recItem variable..
    Set M* in DataItemTableView-Talbe Filter

    In Onaftergetrecord trigger write this
    RecRoutingLine.RESET;
    RecRoutingLine.SETRANGE("Routing No.","No.");
    IF RecRoutingLine.FINDSET THEN
    REPEAT
    IF "Tempo Fabrico Machos" > 0 THEN BEGIN
    RecRoutingLine."Run Time" := "Tempo Fabrico Machos";
    RecRoutingLine.MODIFY;
    END
    UNTIL RecRoutingLine.NEXT = 0;

    Not working...
  • sarmigsarmig Member Posts: 89
    Check why it is not working?

    Yes, I created an item that starts with M....and gave it a "Tempo Fabrico Machos".

    In the Routing Line table, and after running the report, its runtime is still 0...
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    It worked for me without any problem.. :thumbsup:
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    It worked for me without any problem.. :thumbsup:
  • PWLPWL Member Posts: 3
    First of all, "Tempo Fabrico Machos" - is normal field or flow field?

    Do you have solution for your problem or still working on it?
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    PWL wrote:
    First of all, "Tempo Fabrico Machos" - is normal field or flow field?

    Do you have solution for your problem or still working on it?

    Its done here
    http://dynamicsuser.net/forums/t/43798.aspx
Sign In or Register to comment.