Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

script runs at odd times

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    script runs at odd times

    Hi all,


    Thanks in advance!

    I have been fighting this for months off and on and found a way to make sure it does not corrupt data was a quick fix while I chased it down. Must be slipping as i can't chase it down.

    Back ground.

    Form is on a set with tables connected as 1-1 and 1-m
    Form has several layers of conditional objects
    On pressing a button that puts the money layer on top, variables are filled from the money fields in a child table.
    the script is then run to do calcs and placed back in the fields on the form
    the script run is a large one that calculates money
    The script seemd to be running at odd times and messing up the saved numbers
    I placed a stopper at the beginning of the script so saved deals could no longer be saved or even calculated

    NOW is when I found the script was running when running through an embedded browse from record to record. There is nothing there to trigger the script. I have slowly eliminated anything that should cause the script to run. I can not stop it from running while I run through the embedded browse. It runs about every 3 to 5 records all by itself.

    It is not set to run onsave or anyother way I can think of. It is set only to run onentry of specific monetary fields or on leaving them using action scripting/xbasic. NONE of these are in the browse layer.

    Any thoughts are appreciated.

    Ask anything!


    This is the stopper so i know when it tries to run this script.
    Code:
    var->dealstatus = names->status
    if var->dealstatus = "S" then
    	'Displays a message box (style:'OK Button', image: 'Stop symbol', id: 'stockwarning').
    DIM   status_result as N
    DIM   status_warning_OK_Button as L 
    status_warning_OK_Button = .F.
    
    title_var = "This is sold"
    message_text_var = <<%text%
    This is a sold and locked deal.  You will need to make is active to change figures.
    !%text%
    status_warning_result=ui_msg_box(title_var,message_text_var,UI_OK+ UI_FIRST_BUTTON_DEFAULT+ UI_STOP_SYMBOL)
    'Test to see which button on the message box was pressed....
    SELECT
    	CASE status_warning_result = UI_OK_SELECTED
    		status_warning_OK_Button= .t.
    END SELECT
    
        goto exitdeal
    
    end if
    .
    Dave Mason
    [email protected]
    Skype is dave.mason46

    #2
    Re: script runs at odd times

    Any chance something in the browse is referrencing one of the fields that triggers the script?

    I would put a message in the event on every field that the script could be triggered from... then sit back and watch which field message pops up.

    Comment


      #3
      Re: script runs at odd times

      Thanks David,

      There are no fields in the browse that have anything to do with the script.

      The script is only called when a numeric field is either entered or exited and called only from the fields on a layer of the form called money. The embedded browse is on the layer called searches.

      I have also removed all other references to the script anywhere else on the form(buttons,etc).

      .
      Dave Mason
      [email protected]
      Skype is dave.mason46

      Comment


        #4
        Re: script runs at odd times

        But I might suspect that something in the browse is referencing a field not in the browse... is that possible? I would still put a message on each field the script could be run from and see which field or fields is triggering the script. Then work back to find out where that field is being used... got to be called from somewhere.

        Comment


          #5
          Re: script runs at odd times

          Dave:
          Either there is more to it or you are just missing the obvious.
          The obvious:
          You press a button, it brings a layer of the CO to the top
          Then a number of variables are assigned values from the child table
          Then a script runs.
          Does the script run based on the values of the variables?

          If so, at the end of the script, wipe out the variables, i.e. either delete them or give them null values.

          My guess is, the script runs when the values of the variables MATCH the values in the child table and thus, when you fetch through the child table, if and whenever these values match, the script runs.

          Again, assuming this is the case, just wipe out the variables.

          Comment


            #6
            Re: script runs at odd times

            You press a button, it brings a layer of the CO to the top
            Then a number of variables are assigned values from the child table
            Then a script runs.
            Does the script run based on the values of the variables?
            The only time the vars are set is when the ONE button is pressed to set the vars and open the money layer. The script is run from this button.
            Code:
            'Run script locally (using local variables): moneyform
            'Code:::
            select
                case names->group = "BHPH"
            	    script_play_local("monformBHPH")
            	case names->group <> "BHPH"
            		script_play_local("monform")
            end select
            The script is run when entering the first field on the money layer called msrp. It is also run ondeparture of that field. It also runs ondeparture of the other fields on this layer except non-esentials. The vars are changed in the script and saved back to the record. This all works great!

            The value of the variables has no bearing on the script being run.

            Gabe, I am sure of missing something just like you say. Hoping someone will hit a button in my brain that will invoke and AHA.

            It is all the same in v7-v8-v9

            'vars read:::
            var->dealstatus = names->status
            var->vsoldprice = mon->soldprice
            var->vwartax = mon->wartax
            var->vleftotal=mon->totalprice
            var->vfinance = mon->finamt
            var->vdiff = mon->diff
            var->vprofit=mon->prof
            var->vtaxable=mon->taxable
            var->vstax = mon->statetax
            var->vdisctax=mon->disctax
            var->vtradeallow=mon->tradeamount
            var->vtradeliens=mon->tradeliens
            var->vtradeacvs=mon->tradeacv
            var->vpmt=mon->payment
            var->vdocs=mon->docs
            var->vrebates=mon->rebates
            var->vadds=mon->adds
            var->vpmt = mon->payment
            .
            Dave Mason
            [email protected]
            Skype is dave.mason46

            Comment


              #7
              Re: script runs at odd times

              Is "names" a child table?
              Is msrp a field in the child table?

              Comment


                #8
                Re: script runs at odd times

                names is the master table, and holds a lot.

                names is master and mon is 1-1 child(just for the monies. Mon has around 90 fields for various monetary things. names has about 110 feilds.

                msrp is a field in mon as all money fields are there.

                Thanks.

                .
                Dave Mason
                [email protected]
                Skype is dave.mason46

                Comment


                  #9
                  Re: script runs at odd times

                  Originally posted by DaveM View Post
                  Code:
                  'Run script locally (using local variables): moneyform
                  'Code:::
                  select
                      case names->group = "BHPH"
                  	    script_play_local("monformBHPH")
                  	case names->group <> "BHPH"
                  		script_play_local("monform")
                  end select
                  Dave:
                  I am unclear about this!
                  Either way, a script will run.

                  I have to run for an appointment, catch up with you later...

                  Comment


                    #10
                    Re: script runs at odd times

                    yes it will, It is supposed to. The script monform is stopped within that script if it is a saved record. that is where it is not supposed to change the record.

                    The point is that none of it should run from the browse..

                    .
                    Dave Mason
                    [email protected]
                    Skype is dave.mason46

                    Comment


                      #11
                      Re: script runs at odd times

                      i just replaced the embedded browse to no avail.
                      Dave Mason
                      [email protected]
                      Skype is dave.mason46

                      Comment


                        #12
                        Re: script runs at odd times

                        Dave,
                        Not the same scenario but something else to maybe look at. I have an outstanding bug report on v9 regarding the CanArrive event of a form's button which fires when a form opens (and of course should NOT!). Could a related event to your situation be at fault in this way? Try as suggested by placing msgboxes on the events to see if any are firing?

                        Just a shot in the dark really.
                        Mike
                        __________________________________________
                        It is only when we forget all our learning that we begin to know.
                        It's not what you look at that matters, it's what you see.
                        Henry David Thoreau
                        __________________________________________



                        Comment


                          #13
                          Re: script runs at odd times

                          Dave:
                          Naturally one would say post a sample but in all honesty, I wouldn't try to look at it as I suspect it will be a very complex form. What I would suggest though is that you duplicate the set then trim it down taking out as many tables as you can. The ones that has nothing to do with the script and also take out as many of the fields in the form as you can then post that sample if you still see the same behavior. It would be a whole lot easier to look at this sample than the actual one.

                          Comment


                            #14
                            Re: script runs at odd times

                            Thanks Gabe,

                            I will try and do that. It will take some time to do and yes, it is extremely complicated. Could be worse.

                            My worst fear is that the money layer and the embedded brwose layer are affecting each other. In other words, As I am going down the browse, it is somehow thinking I am going down the money form as from 1 field to the next. If so, I would have to seperate into 2 forms(not what I want).

                            .
                            Dave Mason
                            [email protected]
                            Skype is dave.mason46

                            Comment


                              #15
                              Re: script runs at odd times

                              Thanks to all the help.

                              I did an alternate way to stop the pop up

                              I just put it in the button of the money. Now the warning only popsup when they enter the money layer. It is not fixed, but at least useable.

                              I will prepare the db for others to check out, but it may take a while since it is very difficult to do. Too much personal info in there in many tables.
                              Dave Mason
                              [email protected]
                              Skype is dave.mason46

                              Comment

                              Working...
                              X