Alpha Video Training
Results 1 to 20 of 20

Thread: Consecutive Operations

  1. #1
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Consecutive Operations

    I have a small number of Consecutive Operations in a Global Script running Append followed by Export 4 times. The second Append fails with the following:-
    Capture.PNG
    Capture2.PNG
    It does not matter how i change the operations around the second Append always fails.
    This has only started happening since updating to latest patch.
    Any assistance please
    Thanks
    Terry

  2. #2
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,358

    Default Re: Consecutive Operations

    Do you close the table after each individual append and reopen it?

    Latest patch? In V11?
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  3. #3
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,683

    Default Re: Consecutive Operations

    Can we see your script? It may help to wrap each operation into its own UDF inside the script, then your script can control the flow & timing of the ops , etc.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  4. #4
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Re: Consecutive Operations

    I am running pre-defined operations rather than ones written in xbasic so the code behind these includes both opening & closing tables. I also thought of this & had put in a test immediately before the append to make sure the table is closed.
    I appear to have added this message to the wrong forum as it should be under v12 desktop - so it can be moved if you are watching moderator
    Thanks

  5. #5
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,618

    Default Re: Consecutive Operations

    Moved.

    Are you using an Action Script to control the flow?

    If so, the follow Robin's idea and make a UDF for each operation that calls a single step.

    Then take each UDF and call them one by one from a master single UDF.

    I'd suggest each operation use something like:

    APPEND.RUN_SILENT()
    or
    APPEND.RUN()

    depending if you want the confirmations and messages 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.

  6. #6
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Re: Consecutive Operations

    I am using an action script, so the action script uses append.run_silent as the code behind the action to run the pre-defined operation
    Additionally immediately before the Append that fails is a table zap but I have tested this is completed & the table is closed before the append is run.
    Ho do I save a global script to post here?
    Thanks

  7. #7
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,618

    Default Re: Consecutive Operations

    Quote Originally Posted by Terrymorgan View Post
    How do I save a global script to post here?
    Thanks
    Right Click the Action Script in the code tab and export to a text file.

    Attach the text file to a messageboard post.

    The issue you are having is that Action Scripting multi threads the steps. Good for some things, not for what you are doing.

    To control that you need to use UDF's.
    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.

  8. #8
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Re: Consecutive Operations

    Global Script attached.
    This has worked for many years.
    Thanks
    Terry
    Attached Files Attached Files

  9. #9
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,358

    Default Re: Consecutive Operations

    Looks like they busted the Logic , Terry.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  10. #10
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,618

    Default Re: Consecutive Operations

    I'd try something easy first.

    1. open the script in design mode
    2. right click one of the steps and choose View Xbasic
    3. Move from Current Action to All Actions tab
    4. Click Copy code to the clipboard button then Close
    5. Create a new script using Xbasic editor
    6. Paste the clipboard code and save as another name.

    Run that script and see if it has issues.

    IF it does, then you'll need to start breaking the steps into separate functions and calling those functions in sequence.
    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.

  11. #11
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Re: Consecutive Operations

    All individual actions run fine it’s only when the second append runs that it fails, whatever is set as the second append.
    I will try putting the second append in a function & see what happens
    Thanks
    Terry

  12. #12
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Re: Consecutive Operations

    Followed your instructions made no difference - Same Error.
    Created following:
    FUNCTION RunAppend AS V (Apppendname AS C )
    query.filter = ""
    query.order = ""
    If Apppendname <> "" then
    append.run_silent(Apppendname,query.filter)
    End if
    END FUNCTION
    to run the second Append and still no difference.
    Thanks
    Terry

  13. #13
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Re: Consecutive Operations

    FYI I have tried splitting the Global Script into 3 so each append & export is in a separate script, each of the 3 being spawned sequentially.
    Thanks
    Terry

  14. #14
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,683

    Default Re: Consecutive Operations

    I am not understanding this section that appears 3 (?) times in the script:
    'Empty Sagedd.dbf
    delete tbl9
    DIM tbl9 as p
    if table.isopen("sagedd") = .t.
    tbl9 = table.open("sagedd",FILE_RO_SHARED)
    tbl9.close()
    end if
    tbl9 = table.open("sagedd",FILE_RW_EXCLUSIVE)
    tbl9.zap(.T.)
    tbl9.close()
    If sagedd is already open there is nothing here that would close it, although it should trigger an error in the zap.

    Also if query.filter has been set to "" then the append doesn't need to include a filter parameter, which would need to be set to ".t." to have any meaning for the op. Which is also assuming there is not an existing filter defined in the saved op...
    Last edited by MoGrace; 09-19-2019 at 11:56 AM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  15. #15
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Re: Consecutive Operations

    You can ignore the parts before the zap as these were added during testing the error, not the cause.
    There is a filter in the saved op, but I am not at my pc to see what you are referring to, although I suspect you are referring to the bit of code that runs the saved op.
    Thanks
    Terry

  16. #16
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,683

    Default Re: Consecutive Operations

    FUNCTION RunAppend AS V (Appendname AS C )
    query.filter = ""
    query.order = ""
    If Apppendname <> "" then
    append.run_silent(Appendname,query.filter)
    End if
    END FUNCTION
    If the Appendname op has a filter and you want to use it then just put:

    append.run_silent(Appendname)

    Any function that opens a table and errs is likely to leave the table open.

    An example: The filter in the append is "Amount > 0"

    by adding your blank query.filter to the append function that filter now becomes

    "Amount >0 .and. "" " which is nonsensical to Alpha
    Last edited by MoGrace; 09-19-2019 at 01:48 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  17. #17
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,358

    Default Re: Consecutive Operations

    Have you busted the script size?
    Having read it, I am a little confused at the number of commented out lines.
    Have you tried separating the operations into individual items attached to a button?
    You can amalgamate them later when working.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  18. #18
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,618

    Default Re: Consecutive Operations

    Quote Originally Posted by MoGrace View Post
    by adding your blank query.filter to the append function that filter now becomes

    "Amount >0 .and. "" " which is nonsensical to Alpha
    I think that is handled properly with the

    .and. ""

    not added if query.filter is ""

    At least it does for me....
    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.

  19. #19
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,683

    Default Re: Consecutive Operations

    @Al
    I suppose you are right since the default for the filter parameter is "". I should have looked it up...but it seems redundant nonetheless.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  20. #20
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    260

    Default Re: Consecutive Operations

    Changing the function made no difference.
    I now have a working version in the test environment, achieved as follows:-
    Each of the 3 appends are ran using the xbasic behind the saved operations rather than running the operations.
    I do not understand why this works, but obviously a bug in the latest version of Alpha.
    If this does not work in our live environment I will be back here!
    Thanks for all the suggestions
    Terry

Similar Threads

  1. Consecutive grouping in Reports
    By Rbooz946 in forum Alpha Five Version 10 - Desktop Applications
    Replies: 18
    Last Post: 11-29-2010, 03:05 PM
  2. Non Consecutive Job Numbers in Report
    By alexmuir in forum Alpha Five Version 5
    Replies: 4
    Last Post: 06-28-2005, 07:32 AM
  3. consecutive numbering using characters
    By tim trudgen in forum Alpha Five Version 5
    Replies: 2
    Last Post: 04-05-2004, 04:05 AM
  4. Summary - not consecutive
    By Mike Reed in forum Alpha Five Version 5
    Replies: 0
    Last Post: 09-11-2003, 09:10 AM
  5. consecutive numbering
    By eric bellingham in forum Alpha Five Version 4
    Replies: 5
    Last Post: 01-07-2001, 04:05 AM

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
  •