Hi, friends!
I have two reports. One is queued that creates a file from the second one and sends letters after a court. My question is how do I filter the second by report for every newly created file?
Report 50108
First report where created second file.
IF ((StartDateA<>0D) OR (StartDateJ<>0D)) THEN BEGIN //check do you have time sheet for approved for any period
IF UserMail <> '' THEN BEGIN // check for mail <> empty
UserCode := User."Full Name"; // full name for letter
SenderName := COMPANYNAME+'_'+'Time_Sheet_For_Approved';
//---File
ExcFilePath := '\\WC-MSNAV\NAV_Offer\';
ExcFileName := SenderName +'_'+FORMAT(DATE2DMY(TODAY,1))+'.'+FORMAT(DATE2DMY(TODAY,2))+'.'+FORMAT(DATE2DMY(TODAY,3))+'.xls';
Attachment:= ExcFilePath+ExcFileName;
IF EXISTS(Attachment) THEN
ERASE(Attachment);
ExcCreated :=REPORT.SAVEASEXCEL(50112,Attachment);
END;
END;
This created file and send letter but second report not have filter
Return function for Name in second report
ReturnName() : Code[50]
CLEAR(UserSetup);
IF ((StartDateA<>0D) OR (StartDateJ<>0D)) THEN BEGIN
IF UserMail <> '' THEN BEGIN
CLEAR(UserSetup);
UserSetup.SETRANGE("User ID",User."User Name");
IF UserSetup.FINDFIRST THEN
UserCode := UserSetup."Salespers./Purch. Code"
ELSE
UserCode := '';
END;
END;
EXIT(UserCode);
Report 50112
Second report - where I want to put filter for every person
Time Sheet Line - OnPreDataItem()
UsersCode := Report50108.ReturnName;
FILTERGROUP(2);
"Time Sheet Line".SETFILTER("Approver ID",UserCode); // not working I put Message for result only empty
FILTERGROUP(0);
How to filter it every time you sign up with the person from the first report?