Writing a Report

sarmigsarmig Member Posts: 89
Hello...

Need a little help.

I'm writing a report on a table that doesn't exist in the default tables. Basically, there are values that are inputted in a form and then a report has to be generated.

Most of the values I want to generate are in the table, so it's not that complicated, but I'm struggling to include a value from another table, the Item table.

Basically, there's a way to "setrange" both tables (through the field "No."), but how can I "say", in code, that I want to get that value from the field "Material" of the Item table. What do I write after this (on the OnAfterGetRecord trigger)?
RecItem.RESET;
RecItem.SETRANGE("No.", "No. Equipamento");
IF RecItem.FINDFIRST THEN BEGIN
END;

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    RecItem.RESET;
    RecItem.SETRANGE("No.", "No. Equipamento");
    IF RecItem.FINDFIRST THEN BEGIN
    END;
    

    What exactly you want to do with RecItem."Material" field?

    You can simply use RecItem."Material" field in begin end as you have already got the item record..
    RecItem.RESET;
    RecItem.SETRANGE("No.", "No. Equipamento");
    IF RecItem.FINDFIRST THEN BEGIN
      Message('%1',RecItem."Material");
    END;
    
  • sarmigsarmig Member Posts: 89
    I already tried that, but the message came empty...
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Then check whether you have value in Item table for that record.

    Before that check whether you have any value in "No. Equipamento" or not
    Message('%1',"No. Equipamento"); 
    RecItem.RESET;
    RecItem.SETRANGE("No.", "No. Equipamento");
    IF RecItem.FINDFIRST THEN BEGIN
      Message('%1',RecItem."Material");
    END;
    
  • sarmigsarmig Member Posts: 89
    I do have values for the equipment number.

    One odd thing: the value I'm looking for ("material") has a down arrow next to its place at the item form. I noticed that the value of "material" is in the "description" field of another item, more specifically another type of item.

    Is it possible that instead of getting the value of "material", I can get the value of that "description" field? Is it the best way? But how can I make a relation in the same table?
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Check what kind field is equipment number in table FieldClass property(Normal or Flowfield)?

    IF flow field,CalcFormula property will tell you how it is calculating
  • sarmigsarmig Member Posts: 89
    I just found out it was a flowfield, that's why I couldn't get the value.

    All is well now, for now...
  • sarmigsarmig Member Posts: 89
    My report is coming along...

    Now I need to know another thing:

    In the form (the custom form for the custom table I mentioned before), I have a print button. I want to be able to push that button and print the report based on the lines added in that form.

    Should I just set some filters?
  • sarmigsarmig Member Posts: 89
    Before getting into detail about printing the report, another request was made to me:

    Each report shows information about an equipment that's supposed to be manufactured. The equipment is manufactured so that a product is also manufactured using that equipment (t he report shows that too).

    The problem is that the report works well if each equipment (No.) is related only to one product (Item.No.). What if each equipment is going to be used to produce two or more products.

    How can I consider that in my report? How can I print information for two or more products if that's the case. My boss told me to "find out and solve the problem", so here I am, seeking help from you...
  • sarmigsarmig Member Posts: 89
    I found out what I needed to do. I needed to create a new DataItem...
  • sarmigsarmig Member Posts: 89
    Ok, so now I am trying to print the report. The form is working well, and the print button is added. But I don't know how to print the report with the filters. I want to print the report with the lines that are filled in the form. Can you tell me how?
  • sarmigsarmig Member Posts: 89
    I realized that in order to get the result I want, I need to filter both dataitems, the question is, how do I do it?
Sign In or Register to comment.