Workflow to automate sending crystal reports

SOLVED

Can anyone point me in the right direction for how to set up a workflow to automate the running/emailing out of a custom crystal report?  

Parents
  • 0

    This isn't an answer to your question, but we use a third party Crystal Report scheduler called Logicity to automatically send out reports.  It allows us to convert to PDF or Excel automatically.  It is simple and has worked fine for our needs. I only use the X3 workflows for email alerts like when batch tasks or imports fail.

  • 0 in reply to Glen Gillmore

    Glen,

    I have some reports running and emailed based on the workflow as I’ve explained. What I do is I run the report as an action on the workflows start and either export it to excel or pdf. Then in the workflow I specify in the file attachment field the path to the file I just created and the workflow emails the report.

    If it needs to be scheduled and not triggered through any transaction then I can use the Recurring task management and trigger the workflow.

    I agree that this is only for someone that knows a little how to code in X3 and it is not fully GUI but it does the job. You can create the code once and then just call the action with parameters.

  • 0 in reply to Israel Braunfeld

    HI Glen,

    I was recently doing something simular and I'm curious about how (what format) you specified the path to your file. I ran into issues with this and ended up having to use the filpath formula and even then was limited to the file being in the root, or a subfolder in the root of the current X3 folder.  I'd also be intersted in more details on running the report as an action when the workflows start - you you set that up exaclty.  When you mention the code, are you talking about the Call WORKFLOW(TYPEVT,CODEVT,OPERAT,CLEOBJ) from AWRK code? I'm using that as well in  my code.

    Thanks,

    -Mike

  • 0 in reply to Mike Bailey
    verified answer

    Hi Mike,

    To set the file path, add an entry point to AIMP3 and set the FICHIER variable to your desired path. In the example below I set the path and file name and I add the soh number in the file name. Use this same logic in the workflow path.

    $ACTION

       Case ACTION

           When "IMPRIME" : Gosub IMPRIME

       Endcase

    Return

    $IMPRIME

        If ETAT = 'MyReportName'  and DESTINATION = 4 Then

           FICHIER = "C:\tmp\" + [F:SOH]SOHNUM + "_created.xls"

       Endif

    Return

    Regarding the action start, in the last tab of the workflow just select an action and specify to run at start. On the bottom enter the parameters. The action is going to call etat from aimp3

    The answer is yes to running the workflow from code

    Thanks,

    Israel

  • 0 in reply to Israel Braunfeld
    Hi Israel,

    Couldn't figure out how to private message you so, so sorry for adding to this post...

    I'm trying to figure out a way, in code, to produce PDF reports of Invoices, but not for sending/emailing or printing - just to save to a folder with a name I specify. I've tried looking at the the REPORT command, but can't find enough details about all of the parameters. Have you any experience in this and do you have any suggestions?

    Thanks,
    Mike
  • 0 in reply to Mike Bailey
    You want this to happen automatically when an invoice is posted?
  • 0 in reply to HNS
    Sorry, I was incorrect to say invoices. This is actually for a custom Crystal Report. We have a custom screen in which we will enter a Product range, and then we want to print the report to a separate PDF for each item.

    -Mike
  • 0 in reply to Mike Bailey
    Ok. But you want it to print automatically or just when you print the report, you want it to print a separate page for each one instead of all on one page?
  • 0 in reply to HNS
    On the custom screen, after entering the product range (items 00001 - 00099 for example), we'll click on OK and then we want to create a pdf for each separate item with the item number as part of the file name. So, in code, we're trying to figure out how to call the crystal report, pass it the item number and filename, specify the output type as PDF, and specify where it saves/prints the report to.

    -Mike
  • 0 in reply to Mike Bailey
    Hi,

    Below there is an example obviously this is only an example and you’d rather use parameters instead of hard coding. First you need to set the parameters of your report, in this example I only have two params. In your case there may be a begin invoice number and end invoice number param. Then run "Call ETAT()" that runs the actual crystal report with the parameters. “ZPDF” would be your PDF export printer. You would also need to set FICHIER with the desired file name and location as I've previously mentioned.



    Local integer NPPAR_MAX: NBPAR_MAX =10
    Local char TBPAR(20)(1..NBPAR_MAX)
    Local char TBVAL(250)(1..NBPAR_MAX)
    Local Char RPTNAME

    RPTNAME = 'ZMYRPORTNAME'

    TBPAR(1)="NUM"
    TBVAL(1)= "CI123456"
    TBPAR(2)="STOFCY"
    TBVAL(2)= "MYSITE"

    Call ETAT (RPTNAME,'ZPDF',"",0,"",TBPAR,TBVAL) from AIMP3
  • 0 in reply to Mike Bailey
    Ah ok, we use Sage KnowledgeSync for things like that. Another cheap solution I have used in the past is VisualCut. Its easy to set up and you can use it to "Burst" reports like that.
  • 0 in reply to Israel Braunfeld
    SUGGESTED
    Awesome! This looks great. Thank you very much!

    -Mike
Reply Children
No Data