passing a filter to a report

karuchuakaruchua Member Posts: 151
how do i pass a variable to a dataitem from another dataitem without hard coding for it as a filter?
preferably in the predataitem,am trying to setrange but not working

Comments

  • vijay_gvijay_g Member Posts: 884
    Could you be more clear what exactly you want and what you have tried..?
  • karuchuakaruchua Member Posts: 151
    i mean,i want to pass a filter to data item but that filter is a variable i need to capture in the first data item.
  • BeliasBelias Member Posts: 2,998
    set the value of the variable in the first dataitem, then use setrange or setfilter in the onpredataitem of the second one...what's the problem? :-k
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • vijay_gvijay_g Member Posts: 884
    If you are running this report by code(not directly from departmenu) then make a function in report set this variable value in that function and call the function before calling report.
  • BeliasBelias Member Posts: 2,998
    vijay_g wrote:
    If you are running this report by code(not directly from departmenu) then make a function in report set this variable value in that function and call the function before calling report.
    but he said he's trying to pass a filter from one dataitem to another (in the same report).
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • karuchuakaruchua Member Posts: 151
    thank you belias, problem is setting the value to the variable,how do i do tht?

    in the case below.

    SETRANGE("Job No.","Job No.")

    i want to pass the "job no." to "GJobNo " as the variable but when i do like this

    GJobNo:="Labour Header"."Job No.", ...................it doesn't assign,what am i misssing?
  • BeliasBelias Member Posts: 2,998
    I think you're missing the basic information to develop a report: isn't there a senior developer to train you?
    I'm saying this because you've not even given us the information to help you.
    -What are the dataitems?
    -in what triggers did you place the code?
    -can't you use the dataitemlink property?
    -are the dataitems indented correctly?

    with the two lines of code you've written, i cannot guess the solution (i've one in my mind, but i don't have time to shoot in the dark :mrgreen: )
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • karuchuakaruchua Member Posts: 151
    you belias,u now going out of proportion, even if i give you the data items,they r customs dataitems,so how will they help u?
    two i have put that code on the predataitem.
    three the dataitemlink property is not relevant here cant work and also the identing wont work,the two data items are running indepedently for reasons.

    i just need to assingn the value job number to my variable gjobno and am good to go,the value job number is key in the data item.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Assign the value in OnAfterGetRecord Trigger..
  • BeliasBelias Member Posts: 2,998
    karuchua wrote:
    you belias,u now going out of proportion
    I'm not sure to know what does this mean...anyway...
    i want to know what are the dataitems, because i don't know if "labour header" is a variable or a dataitem
    i want to know where did you place the code because...well...you've written it in the wrong place

    evaluate the variable in the onaftergetrecord of the labour header, and then do setrange/setfilter in the other dataitem, or you probably can use copyfilter function, depending on your businness process
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • dansdans Member Posts: 148
    karuchua, we want to try to help you, but it's a bit hard to know exactly what you want to do.
    Could you be more clear about what you are trying to do, what have you tried, and what was the error ?

    To be frank, assigning a value to a variable should be a very easy thing to do, and you should be able to do it easily if you already know the basic. That's why we really need to clarify what you are trying to do.

    And by having your code and data items, we could have a better understanding about it, and why it doesn't work.
    Microsoft Certified IT Professional for Microsoft Dynamics NAV

    Just a happy frood who knows where his towel is
  • karuchuakaruchua Member Posts: 151
    //  IF LPRqHeader."Job Number"='IN13924'  THEN   BEGIN
     // LPRqHeader.SETFILTER(LPRqHeader."Worksheet Ref No.",LlabourHeader."Worksheet Ref No.");
       
     LPRqLine.RESET;
     LPRqLine.SETCURRENTKEY("Requisition Type","Document No.");
     LPRqLine.SETRANGE(LPRqLine."Requisition Type", "Requisition Type"::Issue);
     LPRqLine.SETRANGE(LPRqLine."Document No.",LPRqHeader."No.");
    
      IF LPRqLine.FINDFIRST  THEN BEGIN
          GQtyIssued:=LPRqLine."Qty. Issued";
          GItemDesc:=LPRqLine.Description ;
            END;
     //END;
    
    
    FAPDPDEC09
    
    
    GLHeader."Job No."
    
    
    
    
    
    
           // GRQLine.RESET;
         //   GRQLine.SETCURRENTKEY("Requisition Type","Document No.");
          //  GRQLine.SETRANGE(GRQLine."Requisition Type", "Requisition Type"::Issue);
          //  GRQLine.SETRANGE(GRQLine."Document No.",GRQHeader."No.");
    
             //  IF GRQLine.FINDFIRST  THEN BEGIN
    
    
    
    
    
    
    
    {
    IF (GRQHeader."Job Number"=GLHeader."Job No.") AND (GRQHeader."Worksheet Ref No."=GLHeader."Worksheet Ref No.")
       THEN BEGIN
          IF (GRQLine."Document No."=GDocNo) THEN BEGIN
    
                IF GRQLine.FINDFIRST THEN
    
                   GItemDesc:=GRQLine.Description ;
                  GQtyIssued:=GRQLine."Qty. Issued";
        END;
     END;
       }
    
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Where did you write?
    where is your code which you mentioned in first post?
  • karuchuakaruchua Member Posts: 151
    SORRY FOR THT,this is object codein toext format,ignore the above

    OBJECT Report 50460 Daily Work Sheet
    {
      OBJECT-PROPERTIES
      {
        Date=07/18/12;
        Time=11:55:56 AM;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        UseReqForm=Yes;
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table50027;
            DataItemTableView=SORTING(Job No.,Worksheet Ref No.);
            NewPagePerGroup=No;
            NewPagePerRecord=Yes;
            PrintOnlyIfDetail=No;
            ReqFilterHeadingML=ENU=YES;
            OnPreDataItem=BEGIN
                            SETRANGE("Job No.","Job No.");
    
    
                            //GJobNo:='in13924';
    
                            //IF GLHeader."Job No." <> '' THEN
                          END;
    
            OnAfterGetRecord=BEGIN
                                 GJobNo:=GLHeader."Job No.";
                             END;
    
            ReqFilterFields=Job No.,Worksheet Ref No.,Customer Name;
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=20400;
                SectionHeight=3384;
              }
              CONTROLS
              {
                { 1000000031;Image  ;2880 ;0    ;3300 ;1269 ;Bitmap=c:\dands2.bmp }
                { 1000000030;Image  ;150  ;0    ;2730 ;2115 ;Bitmap=c:\dands.bmp }
                { 1000000032;Image  ;3000 ;846  ;4020 ;1269 ;Bitmap=c:\dands3.bmp }
                { 1000000033;TextBox;13950;0    ;3150 ;423  ;HorzAlign=Right;
                                                             SourceExpr=FORMAT(TODAY,0,4);
                                                             DataSetFieldName=FORMAT_TODAY_0_4_ }
                { 1000000035;TextBox;14850;846  ;2250 ;423  ;HorzAlign=Right;
                                                             SourceExpr=USERID;
                                                             DataSetFieldName=USERID }
                { 1000000009;Label  ;7350 ;2115 ;7950 ;846  ;FontSize=20;
                                                             FontBold=Yes;
                                                             CaptionML=ENU=Daily Work Sheet;
                                                             DataSetFieldName=Daily_Work_SheetCaption }
                { 1000000025;TextBox;15900;423  ;750  ;423  ;CaptionML=ENU=Page;
                                                             SourceExpr=CurrReport.PAGENO;
                                                             DataSetFieldName=CurrReport_PAGENO }
                { 1000000018;Label  ;15450;423  ;600  ;423  ;CaptionML=ENU=Page;
                                                             DataSetFieldName=PageCaption }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=20400;
                SectionHeight=5076;
              }
              CONTROLS
              {
                { 1000000000;TextBox;2250 ;423  ;5250 ;423  ;SourceExpr="Sales Person";
                                                             DataSetFieldName=Labour_Header__Sales_Person_ }
                { 1000000001;Label  ;0    ;423  ;2250 ;423  ;ParentControl=1000000000;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             CaptionML=ENU=TECHNICIAN;
                                                             DataSetFieldName=TeCHNICIANCaption }
                { 1000000010;TextBox;2250 ;0    ;5250 ;423  ;SourceExpr="Customer Name";
                                                             DataSetFieldName=Labour_Header__Customer_Name_ }
                { 1000000011;Label  ;0    ;0    ;2250 ;423  ;ParentControl=1000000010;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             CaptionML=ENU=CLIENT;
                                                             DataSetFieldName=CLIENTCaption }
                { 1000000012;TextBox;14400;0    ;3600 ;423  ;SourceExpr="Job Reference";
                                                             DataSetFieldName=Labour_Header__Job_Reference_ }
                { 1000000013;Label  ;12450;0    ;1950 ;423  ;ParentControl=1000000012;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             CaptionML=ENU=JOB NO;
                                                             DataSetFieldName=JOB_NOCaption }
                { 1000000014;TextBox;13650;423  ;1650 ;423  ;SourceExpr="Charge Date";
                                                             DataSetFieldName=Labour_Header__Charge_Date_ }
                { 1000000015;Label  ;12300;423  ;750  ;423  ;ParentControl=1000000014;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             CaptionML=ENU=DATE;
                                                             DataSetFieldName=DATECaption }
                { 1000000016;TextBox;14400;846  ;3450 ;423  ;SourceExpr="Worksheet Ref No.";
                                                             DataSetFieldName=Labour_Header__Worksheet_Ref_No__ }
                { 1000000017;Label  ;12450;846  ;1500 ;423  ;ParentControl=1000000016;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             CaptionML=ENU=SERIAL NO.;
                                                             DataSetFieldName=SERIAL_NO_Caption }
                { 1000000002;Label  ;0    ;1269 ;1500 ;423  ;FontBold=Yes;
                                                             CaptionML=ENU=REPORT;
                                                             DataSetFieldName=REPORTCaption }
                { 1000000003;TextBox;4350 ;1269 ;2550 ;423  ;SourceExpr="Arrival Time";
                                                             DataSetFieldName=Labour_Header__Arrival_Time_ }
                { 1000000004;Label  ;1800 ;1269 ;2250 ;423  ;ParentControl=1000000003;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             DataSetFieldName=Labour_Header__Arrival_Time_Caption }
                { 1000000005;TextBox;4500 ;1692 ;2400 ;423  ;SourceExpr="Departure Time";
                                                             DataSetFieldName=Labour_Header__Departure_Time_ }
                { 1000000006;Label  ;2250 ;1692 ;2250 ;423  ;ParentControl=1000000005;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             DataSetFieldName=Labour_Header__Departure_Time_Caption }
                { 1000000007;TextBox;4350 ;2115 ;2550 ;423  ;SourceExpr="Time at work";
                                                             DataSetFieldName=Labour_Header__Time_at_work_ }
                { 1000000008;Label  ;1800 ;2115 ;2400 ;423  ;ParentControl=1000000007;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             DataSetFieldName=Labour_Header__Time_at_work_Caption }
                { 1000000019;TextBox;3000 ;2961 ;11100;2115 ;SourceExpr="Worksheet Description";
                                                             DataSetFieldName=Labour_Header__Worksheet_Description_ }
                { 1000000020;Label  ;0    ;2961 ;3000 ;423  ;ParentControl=1000000019;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             DataSetFieldName=Labour_Header__Worksheet_Description_Caption }
              }
               }
          }
           }
        { PROPERTIES
          {
            DataItemTable=Table50002;
            DataItemTableView=SORTING(Requisition Type,Department,Job Number,Client)
                              WHERE(Requisition Type=FILTER(Issue));
            PrintOnlyIfDetail=No;
            OnPreDataItem=BEGIN
                             SETRANGE("Job Number",GJobNo);
                          END;
    
          }
          SECTIONS
          {
          }
           }
        { PROPERTIES
          {
            DataItemIndent=1;
            DataItemTable=Table50003;
            DataItemTableView=SORTING(Document No.,Line No.)
                              WHERE(Type=FILTER(Item));
            NewPagePerGroup=Yes;
            PrintOnlyIfDetail=No;
            DataItemLink=Document No.=FIELD(No.);
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=20400;
                SectionHeight=2115;
                OnPreSection=BEGIN
    
                               //CurrReport.SHOWOUTPUT(TRUE);
                             END;
    
              }
              CONTROLS
              {
                { 1000000021;TextBox;600  ;846  ;2700 ;423  ;SourceExpr="Part No." }
                { 1000000023;TextBox;3900 ;846  ;4800 ;423  ;SourceExpr="Posted Gen. Requisition Line".Description }
                { 1000000026;TextBox;9750 ;846  ;2100 ;423  ;SourceExpr="Posted Gen. Requisition Line"."Qty. Issued" }
                { 1000000028;TextBox;14250;846  ;1800 ;423  ;SourceExpr="Posted Gen. Requisition Line"."Document No." }
                { 1000000022;Label  ;750  ;0    ;2700 ;423  ;ParentControl=1000000021;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000024;Label  ;4050 ;0    ;2700 ;423  ;ParentControl=1000000023;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             CaptionML=ENU=Description }
                { 1000000027;Label  ;9600 ;0    ;2100 ;423  ;ParentControl=1000000026;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes;
                                                             CaptionML=ENU=Quantity }
                { 1000000029;Label  ;14250;0    ;1500 ;423  ;ParentControl=1000000028;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=8910;
          Height=6380;
          SaveValues=Yes;
        }
        CONTROLS
        {
        }
      }
      REQUESTPAGE
      {
        PROPERTIES
        {
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        VAR
          GRptOption@1000000000 : Boolean;
          GQtyIssued@1000000001 : Integer;
          GItemDesc@1000000002 : Code[50];
          GRQHeader@1000000003 : Record 50002;
          GRQLine@1000000004 : Record 50003;
          GLHeader@1000000005 : Record 50027;
          GJobNo@1000000006 : Code[20];
          GDocNo@1000000007 : Code[20];
          GWNo@1000000008 : Code[20];
    
        BEGIN
        END.
      }
      RDLDATA
      {
      }
    }
    
    
  • BeliasBelias Member Posts: 2,998
    GJobNo:=GLHeader."Job No.";
    
    glheader is not your dataitem (i didn't import your object, but i've not seen the dataitem name).
    instead, you should do this, i think:
    GJobNo:="Job No.";
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    OnPreDataItem=BEGIN
                            SETRANGE("Job No.","Job No.");
    
    What is the use of above code?
    OnAfterGetRecord=BEGIN
                                 GJobNo:=GLHeader."Job No.";
    
    Where did you write code to get GLHeader record?
  • karuchuakaruchua Member Posts: 151
    @belias,yes glheader is not my dataitem but on tyring the above it doesnt work,my dataitems are

    1.labour header
    2.posted gen req. header
    3.posted gen req.line


    @mohana_cse06,the use of tht setrange is to filter the records by job number.

    i havent written code to get the glheader,when i try writing,am getting an error that my data item doesn.t exist
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    karuchua wrote:
    @mohana_cse06,the use of tht setrange is to filter the records by job number.
    the code doesn't work as you will have "Job No." blank in onpredataitem..

    remove the code..

    can you show us the code which is returning error?
  • karuchuakaruchua Member Posts: 151
    @mohana_cse06,if i remove tht code,the results are null.

    the code is below,its on the aftergetrecord.


    GLHeader.GET(GLHeader."Job No.");
    GJobNo:="Job No.";
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Are you a partner or end-user?
    if Partner, please read the basic technical documents..
    if end-user, contact partner.. :thumbsup:
  • karuchuakaruchua Member Posts: 151
    @mohana_cse06,am not sure u helped.
  • dansdans Member Posts: 148
    karuchua, are you a partner or an end user ? is there any senior to help you or train you ? we could see here that you do need the basic training or you need to spend some time to read the technical documentation first. you're not supposed to jump to development before you have the basic knowledge (variable, data item, GET, etc).
    Microsoft Certified IT Professional for Microsoft Dynamics NAV

    Just a happy frood who knows where his towel is
  • karuchuakaruchua Member Posts: 151
    @dans,i would appreciate if you would tell mi,where the problem is other than giving mi stories.
Sign In or Register to comment.