18. Februar 2014 12:55
StructPlanLine.RESET;
StructPlanLine.SETFILTER("JSP Code", '994740');
IF StructPlanLine.FINDFIRST THEN
BEGIN
  StructRef.GETTABLE(StructPlanLine);
  MESSAGE(FORMAT(StructRef.COUNT));
  MESSAGE(FORMAT(StructRef.RECORDID));
  RefVariant2 := StructRef;
  MESSAGE(FORMAT(RefVariant2.ISRECORD));
  MESSAGE(FORMAT(RefVariant2));  
  REPORT.RUNMODAL(50003,TRUE,TRUE,RefVariant2);
END;
18. Februar 2014 13:38
18. Februar 2014 13:53
18. Februar 2014 14:14
rifmetroid hat geschrieben:Die Variantvariable scheint nicht richtig als Filter beim Report zu wirken.
18. Februar 2014 14:21
18. Februar 2014 14:54
18. Februar 2014 15:11
18. Februar 2014 15:24
18. Februar 2014 15:25
 . Aber ob du in deinem Beispiel nun
 . Aber ob du in deinem Beispiel nunREPORT.RUNMODAL(50003,TRUE,TRUE,RefVariant2);Rep50003.setFilterView(StructRef.getview);
Rep50003.settableview(RefVariant2);
Rep50003.userequestform := false;
Rep50003.runmodal;rifmetroid hat geschrieben:die Codeunit, da ich dann anhand der RecordRef den eigentlichen Record suchen muss.
18. Februar 2014 15:27
rifmetroid hat geschrieben:jetzt funktioniert es aber super mit GetView.
18. Februar 2014 16:07
OnRun()
StructPlanLine2.RESET;
StructPlanLine2.SETFILTER("JSP Code", '994740');
IF StructPlanLine2.FINDFIRST THEN
BEGIN
  StructRef.GETTABLE(StructPlanLine2);
  CreatePDF('\\server\test\temp\', 'Test', 50003, StructRef.RECORDID);
END;
CreatePDF(Path : Text[1024];FileName : Text[255];ReportID : Integer;RecID : RecordID)
IF Object.GET(Object.Type::Report,'',ReportID) THEN
BEGIN
  IF ISCLEAR(PDFCreator) THEN
    CREATE(PDFCreator);
  IF ISCLEAR(PDFCreatorError) THEN
    CREATE(PDFCreatorError);
  PDFCreatorError := PDFCreator.cError;
  IF PDFCreator.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN
       ERROR('Status: Error[' + FORMAT(PDFCreatorError.Number) + ']: ' + PDFCreatorError.Description);
  PDFCreatorOption := PDFCreator.cOptions;
  PDFCreatorOption.UseAutosave := 1;
  PDFCreatorOption.UseAutosaveDirectory := 1;
  PDFCreatorOption.AutosaveDirectory := Path;
  PDFCreatorOption.AutosaveFormat := 0;
  PDFCreatorOption.AutosaveFilename := FileName;
  PDFCreator.cOptions := PDFCreatorOption;
  PDFCreator.cClearCache();
  DefaultPrinter := PDFCreator.cDefaultPrinter;
  PDFCreator.cDefaultPrinter := 'PDFCreator';
  PDFCreator.cPrinterStop := FALSE;
  PrintReport(ReportID, RecID);
  SLEEP(2000);
  CLEAR(PDFCreator);
  CLEAR(PDFCreatorError);
END;
PrintReport(ReportID : Integer;RecID : RecordID)
IF RecRef.GET(RecID)THEN
BEGIN
  CASE RecRef.NUMBER OF
    DATABASE::"Structural Plan Line":
    BEGIN
      RecRef.SETTABLE(StructPlanLine);
      StructPlanLine.SETFILTER(StructPlanLine."JSP Code", StructPlanLine."JSP Code");
      IF StructPlanLine.FINDFIRST THEN
      BEGIN
        REPORT.RUNMODAL(ReportID,FALSE,TRUE, StructPlanLine);
      END;
    END;
  END;
END;