Change Report Name when printing

Hi There

For Sage X3 V12 

I am trying to get Sage to print/save with different file name than the Crystal Report name

Have added entry point AIMP3 custom script ZAIMP3

Here is my code

$ ACTION 
Case  ACTION 
    When  "PARAM"     : Gosub PARAM
 Endcase 
Return
 
 
$PARAM 
If  [F:ARP]RPTCOD = "ZPO"  
    Local  Char XPARAM (250) 
    XPARAM = chr$(1)+"E:\Sage\folders\TEST\ATT\"+[F:POH]POHNUM+".pdf" 
    Call SETPARAM("_ExportFile",NBPAR,PARAMETRE,XPARAM) From ETAT
 Endif 
Return

I have complied it and logged out and back in again

It's not working as expected, receive no errors but it's not doing anything

Parents
  • We have code that renames a PDF of the invoice to customer + Invoice number + SO number + customer PO # and all fixed length with zero fill.  So PO always starts at position X.   I didn't program it.    Greytrix did it to my specs.   It was difficult.   It took significant time to debug it. 

    If you get no other help, we can ask Greytrix or we could pull the code and look at it perhaps. 

Reply
  • We have code that renames a PDF of the invoice to customer + Invoice number + SO number + customer PO # and all fixed length with zero fill.  So PO always starts at position X.   I didn't program it.    Greytrix did it to my specs.   It was difficult.   It took significant time to debug it. 

    If you get no other help, we can ask Greytrix or we could pull the code and look at it perhaps. 

Children
  • in reply to Stephen

    Thanks Stephen

    If you can perhaps get the code that would be great,  I just need a starting point. 

    My workaround was to use AIMP3 entry point to write to the Server. Once the file is written it pops up with a notification that provides a URL to the file to open it. I defaulted the print destination to print to file to achieve this. It's not ideal but it's working for now. 

  • in reply to Moomin Rider

    >>Once the file is written it pops up with a notification that provides a URL to the file to open it. 

    This seems like what Greytrix came up with.    It created a temp file as a PDF and saved it.  Then it openned the file and renamed it.    Then it proceeded to preview mode on the new name. 

    We had issue with timing and don't remember the cure but it may have just been a delay.  We would attempt to open the file in preview mode and it wouldn't be there yet.   This was the biggest issue during the whole process.

  • in reply to Stephen

    I think they might have done the same as what I did. 

    I have since revised my dev. Rather than it giving it a link with notification I have now made it so that is saves to the Transactions under attachments with the Correct document number like below..

  • in reply to Moomin Rider

    I would be very interested in how you did this if you are willing to share.