Alpha Video Training
Results 1 to 19 of 19

Thread: Script help.

  1. #1
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Script help.

    Al and other still having two problems with my script.
    1) report comes back with a pop-up and asks do I want to refresh "Yes" or "NO" .
    2) The report populates the email all looks good , however, the email is waiting for me to hit the send button can this be automated?

    Here she is.

    'Refresh data in Passive-Link table(s)

    DIM tableList as c
    tableList = <<%txt%
    item
    iteminventory%txt%
    dim count as n
    count = line_count(tableList)
    dim i as n
    dim pr as p
    dim table_i as c
    for i = 1 to (count)
    table_i = word(tableList,i,crlf())
    pr =a5_RefreshPassiveLinkTable(table_i,.f.,.f.)
    if pr.error = .t. then
    ui_msg_box("Error","Table data was not refreshed: '" + table_i + "'." + crlf(3) + "Error reported was: " + crlf()+pr.errorText,UI_STOP_SYMBOL)
    end if
    next i

    'Send a report, label, letter, form or browse layout as an attachment to an e-mail message. You can specify which records to send.

    query.filter = ""
    query.order = ""

    to_param = a5_eval_expression("jmucci@rochemintl.com",local_variables())
    cc_param = a5_eval_expression("zlingner@rochemintl.com",local_variables())
    bcc_param = a5_eval_expression("",local_variables())
    subject_param = a5_eval_expression("File from Night time",local_variables())
    message_param = a5_eval_expression("worked",local_variables())


    :Report.Send("JoAnn 2","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)

    Thanks John

  2. #2
    "Certified" Alphaholic
    Real Name
    Andrew Schone
    Join Date
    Dec 2005
    Location
    Kansas
    Posts
    1,047

    Default Re: Script help.

    <object>.send()
    http://support.alphasoftware.com/alp...SEND%28%29.htm

    Note : This method requires that the user press the Send key to complete the transmission. as a result <OBJECT>.SEND()is not appropriate for use in web applications. To send a report as an attachment without user interaction, create the attachment with REPORT.SAVEAS() and send it with EMAIL_SEND() or EMAIL_SEND2().

  3. #3
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Thank you for the quick reply
    However do I just replace the line to read this way;

    :Report.Send("JoAnn 2","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)

    <object>.send("JoAnn 2","PDF",query.filter,query.order,"default",to_param,subject_param,message_param,cc_param,bcc_param)


    Thanks
    John

  4. #4
    "Certified" Alphaholic
    Real Name
    Andrew Schone
    Join Date
    Dec 2005
    Location
    Kansas
    Posts
    1,047

    Default Re: Script help.

    Create the attachment with REPORT.SAVEAS() and send it with EMAIL_SEND() or EMAIL_SEND2().

  5. #5
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Thanks I'm given it a shot again
    Here is the code and the error.

    'Date Created: 25-Jan-2011 02:29:22 PM
    'Last Updated: 25-Jan-2011 02:29:22 PM
    'Created By : jmucci
    'Updated By : jmucci
    'Save a report, label, letter, form or browse to an Acrobat, Rich Text, HTML or Plain Text file. You can specify which records to save.

    query.filter = ""
    query.order = ""



    :Report.SaveAs("JoAnn 2","PDF",query.filter,query.order,"C:\Documents and Settings\jmucci\My Documents\Joann2",.F.)

    'Send files via e-mail.
    param_to = "Jmucci@rochemintl.com"
    param_subject = "Inventory Report"
    param_cc = ""
    param_bcc = ""
    attachment_list = <<%a%
    C:\Documents and Settings\jmucci\My Documents\Joann2.pdf
    %a%

    param_message = "See attached files: "+crlf()+attachment_list
    param_attachments = attachment_list
    'Send the e-mail message directly - do not open the Alpha Five e-mail client
    send_result = email_send(parm_to,param_subject,param_message,param_attachments,param_cc,param_bcc)
    if send_result <> 1 then
    ui_msg_box("Error","E-mail message was not sent.",UI_STOP_SYMBOL)
    end if

    This is the error.

    Script:Joann 2 New Line:26
    send_result = email_send(parm_to, param_attachments)
    Variable "parm_to" not found

  6. #6
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,563

    Default Re: Script help.

    John

    Looks like a small error in action scripting..

    Code:
    param_to = "Jmucci@rochemintl.com"
    
    Script:Joann 2 New Line:26
    send_result = email_send(parm_to, param_attachments)
    Variable "parm_to" not found
    Notice the missing 'a' in param_to vs parm_to

    Right click the action script - convert to xbasic and then edit parm_to to param_to

    In the meantime, we'll get the tech team to fix that....
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  7. #7
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Al that was me not the tech team.

    Here is the new srcipt same problem though.

    'Save a report, label, letter, form or browse to an Acrobat, Rich Text, HTML or Plain Text file. You can specify which records to save.

    query.filter = ""
    query.order = ""



    :Report.SaveAs("JoAnn 2","PDF",query.filter,query.order,"C:\Documents and Settings\jmucci\My Documents\Joann2",.F.)

    'Send files via e-mail.
    param__to = "Jmucci@rochemintl.com"
    param_subject = "Inventory Report"
    param_cc = ""
    param_bcc = ""
    attachment_list = <<%a%
    C:\Documents and Settings\jmucci\My Documents\Joann2.pdf
    %a%

    param_message = "See attached files: "+crlf()+attachment_list
    param_attachments = attachment_list
    'Send the e-mail message directly - do not open the Alpha Five e-mail client
    send_result = email_send(param_to,param_subject,param_message,param_attachments,param_cc,param_bcc)
    if send_result <> 1 then
    ui_msg_box("Error","E-mail message was not sent.",UI_STOP_SYMBOL)
    end if
    Last edited by jtm311; 01-25-2011 at 03:01 PM.

  8. #8
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Al

    I got it. You will have to talk with the tech team.. It is adding an extra space in this line param__to See it :)

    John

  9. #9
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    BTW Al or others do you see anyway to remove the second refresh. The first one runs silent, however, I'm getting a second pop up asking me to refresh the data.

    Thanks
    John

  10. #10
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Al,

    Great Webinar today, however, I may have missed a step. Below is the standard Script, did I have to add anything additional to the script because she still asked to refresh the table, even though we changed it from a passive link table.

    'Date Created: 31-Jan-2011 10:34:14 AM
    'Last Updated: 03-Feb-2011 04:15:36 PM
    'Created By : jmucci
    'Updated By : jmucci
    '

    query.filter = ""
    query.order = ""

    :Report.SaveAs("Inventory On Hand","PDF",query.filter,query.order,"C:\Documents and Settings\jmucci\My Documents\InventoryOnHand.pdf",.F.)

    'Send files via e-mail.
    param_to = "salesdoc@f01.ihostsharepoint.com"
    param_subject = "Inventory"
    param_cc = ""
    param_bcc = ""
    attachment_list = <<%a%
    C:\Documents and Settings\jmucci\My Documents\InventoryOnHand.pdf
    %a%

    param_message = "See attached files: "+crlf()+attachment_list
    param_attachments = attachment_list
    'Send the e-mail message directly - do not open the Alpha Five e-mail client
    send_result = email_send(param_to,param_subject,param_message,param_attachments,param_cc,param_bcc)
    if send_result <> 1 then
    ui_msg_box("Error","E-mail message was not sent.",UI_STOP_SYMBOL)
    end if

    a5.Close()

  11. #11
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,563

    Default Re: Script help.

    I don't see a call to the import operation...

    Does that get called from somewhere else?

    Check the icon on the table to see if it shows a passive link or not..
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  12. #12
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Sorry All did not get notified that I had an answer.

    Here is the correct code. It does refresh and import the records, however, stops at the same point and asks me to refresh before sending. Yes the link is not red.

    'Date Created: 31-Jan-2011 10:34:14 AM
    'Last Updated: 08-Feb-2011 11:49:25 AM
    'Created By : jmucci
    'Updated By : jmucci
    '
    'Run a saved 'Import' operation: 'ImpItemInventory'.
    query.filter = ".t."
    query.order = ""

    DIM operation_name as c
    operation_name = "ImpItemInventory"
    If operation_name <> "" then
    import.run_silent(operation_name)
    End if


    :Report.SaveAs("Inventory On Hand","PDF",query.filter,query.order,"C:\Documents and Settings\jmucci\My Documents\InventoryOnHand.pdf",.F.)

    'Send files via e-mail.
    param_to = "salesdoc@f01.ihostsharepoint.com"
    param_subject = "Inventory"
    param_cc = ""
    param_bcc = ""
    attachment_list = <<%a%
    C:\Documents and Settings\jmucci\My Documents\InventoryOnHand.pdf
    %a%

    param_message = "See attached files: "+crlf()+attachment_list
    param_attachments = attachment_list
    'Send the e-mail message directly - do not open the Alpha Five e-mail client
    send_result = email_send(param_to,param_subject,param_message,param_attachments,param_cc,param_bcc)
    if send_result <> 1 then
    ui_msg_box("Error","E-mail message was not sent.",UI_STOP_SYMBOL)
    end if

    a5.Close()

  13. #13
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Sorry All did not get notified that I had an answer.

    Here is the correct code. It does refresh and import the records, however, stops at the same point and asks me to refresh before savinf the file. Yes the link is not red.

    'Date Created: 31-Jan-2011 10:34:14 AM
    'Last Updated: 08-Feb-2011 11:49:25 AM
    'Created By : jmucci
    'Updated By : jmucci
    '
    'Run a saved 'Import' operation: 'ImpItemInventory'.
    query.filter = ".t."
    query.order = ""

    DIM operation_name as c
    operation_name = "ImpItemInventory"
    If operation_name <> "" then
    import.run_silent(operation_name)
    End if


    :Report.SaveAs("Inventory On Hand","PDF",query.filter,query.order,"C:\Documents and Settings\jmucci\My Documents\InventoryOnHand.pdf",.F.)

    'Send files via e-mail.
    param_to = "salesdoc@f01.ihostsharepoint.com"
    param_subject = "Inventory"
    param_cc = ""
    param_bcc = ""
    attachment_list = <<%a%
    C:\Documents and Settings\jmucci\My Documents\InventoryOnHand.pdf
    %a%

    param_message = "See attached files: "+crlf()+attachment_list
    param_attachments = attachment_list
    'Send the e-mail message directly - do not open the Alpha Five e-mail client
    send_result = email_send(param_to,param_subject,param_message,param_attachments,param_cc,param_bcc)
    if send_result <> 1 then
    ui_msg_box("Error","E-mail message was not sent.",UI_STOP_SYMBOL)
    end if

    a5.Close()

  14. #14
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,563

    Default Re: Script help.

    John

    Are there any other tables in the set that the report is built on?

    If so, are they still passive linked tables?
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  15. #15
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    All I thought you had for a minute there was a second table I added it to the operation we wrote, however still the same result. Both tables show no link.
    John

  16. #16
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,563

    Default Re: Script help.

    Let's look at this on Thursday..
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  17. #17
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Thanks Al, see you Thursday.

  18. #18
    Member
    Real Name
    John Mucci
    Join Date
    Nov 2010
    Location
    New York
    Posts
    311

    Default Re: Script help.

    Al,

    Very strang since we fixed that first refresh, all of the other tables are working correctly now ;) I'm not even calling the operation again as long as that table is refreshed previously.

    Strang but all works great. I now have fully automated the reports and send them via email before I get in the office :)

    John

  19. #19
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,563

    Default Re: Script help.

    YEAH!
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

Similar Threads

  1. Script to create a report turns into a delete script when a different user is logged
    By werder101010 in forum Alpha Five Version 10 - Desktop Applications
    Replies: 3
    Last Post: 10-27-2010, 01:58 PM
  2. Replies: 2
    Last Post: 02-15-2006, 05:46 AM
  3. Alpha Five Action Script: Script Create
    By debwelch in forum Alpha Five Version 5
    Replies: 1
    Last Post: 04-30-2004, 10:35 AM
  4. Date dialog script & report script won't combi
    By rbierman@iowbar.org in forum Alpha Five Version 5
    Replies: 6
    Last Post: 12-07-2003, 07:40 AM
  5. Is it psoosible to write a script 2 print a script
    By Graham Wickens in forum Alpha Five Version 4
    Replies: 2
    Last Post: 11-03-2002, 12:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •