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

parentform.mark_record() fetches next record

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

    parentform.mark_record() fetches next record

    I have an invoicing application that I after the invoice is filled out the user pushes a button that starts the final process to print the invoice etc.

    The xbasic script I'm using in the "on push" button to begin the process is:

    'Saves & marks current record
    parentform.commit()
    parentform.mark_record()

    'Save calc'ed fields to Database
    DIM tbl as p
    tbl=table.open("invoice_header")
    tbl.fetch_first()
    tbl.change_begin()
    tbl.Total_Parts=Calc->Parts
    tbl.Total_Labor=Calc->Labor
    tbl.Total_Parts_Labor=Calc->Total
    tbl.Total_Amt_Disc=Calc->Amt_disc
    tbl.Total_Amt_Tax=Calc->Amt_Tax
    tbl.Grand_Total=Calc->Grand_Total
    tbl.change_end(.t.)

    'To change to the checkout form
    rec = table.current().recno()
    fp = form.view( "checkout" )
    fp.index_set( "" )
    fp.find( rec )
    fp.index_set( "cus_id" )

    This code works fine for 3 or 4 invoices and then say on the 4th invoice, you push the button and rather than staying on the current invoice, it moves to the next invoice. I've played with the code and if I take out the parentform.mark_record() all is well. I Any help will be greatly appreciated...

    #2
    RE: parentform.mark_record() fetches next record

    Hal:

    The form the button is on (parentform) is based on which table or set? The invoice set?

    Is this the same form as the checkout form mentioned later? I guess no.

    "...you push the button and rather than staying on the current invoice, it moves to the next invoice." In the previous sentence, to which form does "it" refer? At what point in the code does it change focus?

    Bill
    Bill Hanigsberg

    Comment


      #3
      RE: parentform.mark_record() fetches next record

      Bill:

      The form the button is on (parentform) is based on the invoice set. The checkout form is seperate from the invoice form.

      When I push the button, as the checkout form gets focus, you can watch the record change on the invoice form to the next record. It appears after the .mark_record(), is when it changes to the next invoice. "The checkout form pops up on top of the invoice window" (see attached .jpg)

      If I close the checkout form and fetch the record that I was invoicing, it has been marked() as I wanted.

      I appreciate your help.

      Hal

      Comment


        #4
        RE: parentform.mark_record() fetches next record

        Hi Hal
        I am by no means an expert with scripts, but have learned some ways to get them work the way I want. Since you say the invoice record is changing after the mark, how about getting the recno right after the commit, then do the mark, then fetch with the recno variable to get the record back to the one you want. Then open the checkout form. If your invoice form is indexed by something other than recno, you can also pass the key data to a variable and find by that that instead of recno. Just a thought.

        Mick

        Comment


          #5
          RE: parentform.mark_record() fetches next record

          Hal,

          I don't think parentform.mark_record() advances the record pointer.

          1) if it did, your script would skip the second invoice each time, right?

          2) I built a simple model here. Put a button on the form that did this:

          parentform.commit()
          parentform.mark_record()

          Added an embedded browse to the same form. When the button was pushed the current record is marked, but the record pointer does not advance to the next record.


          Is it possible you have not shown us the entire script your button push runs?

          -- tom

          Comment


            #6
            RE: parentform.mark_record() fetches next record

            Tom:

            I've checked the script of my button against my original post to ensure I didn't miss anything, I've posted everything.

            When the Checkout form fires, I do not have any further scripts run until I push the "complete invoicing" button.

            "...I don't think parentform.mark_record() advances the record pointer. 1) if it did, your script would skip the second invoice each time, right?..."

            I played with the invoicing system to check the number of records it's skipping, I put six in and only record #2 was skipped? However, if I take out the parentform.mark_record() and attempt to invoice that same record #2, it allowed me to do it?

            I do appreciate your help

            -Hal

            Comment


              #7
              RE: parentform.mark_record() fetches next record

              Hi Mick:

              I'am fairly new to scripts and not quite clear on your reply. I'll have to open the books here and do some research to try and follow what you suggested.

              "... how about getting the recno right after the commit..." Could you give me an example of how this is done?

              "..then do the mark, then fetch with the recno variable to get the record back to the one you want..."
              Again, not clear on where I should go with this.


              Thanks,

              -Hal

              Comment


                #8
                RE: parentform.mark_record() fetches next record

                Hi Hal

                Something like this

                parent.commit()
                dim global rec as n
                tbl=table.current()
                rec=tbl.recno()
                parent.mark_record()
                :this.index_set("")
                tbl.fetch_find(rec)
                parentform.resynch()

                'goes to the rest of the script transferring the calc fields, etc.

                If you don't want to keep the record number as the primary sort you can add another :this.index_set("your index") to the bottom of it.

                Mick

                Comment


                  #9
                  RE: parentform.mark_record() fetches next record

                  Hal, the interaction of events in your field rules, and the two forms, and the various buttons is complex. Best way to get to the bottom is to post a working example, using dummy data if your data is sensitive. Why not zip the database and post it here, with a text file explaining which forms and buttons are involved?

                  -- tom

                  Comment


                    #10
                    RE: parentform.mark_record() fetches next record

                    Hal, another idea.

                    Check out the redim command. If your script is running multiple times in a row, you probably want to redim the variables, instead of just dimming them. I think redim is the only way to re-initialize a variable in this kind of situation.

                    Don't know if this will help, but thought I'd mention it.

                    -- tom

                    Comment


                      #11
                      RE: parentform.mark_record() fetches next record

                      Tom:

                      "...the interaction of events in your field rules,
                      and the two forms, and the various buttons is complex.
                      Best way to get to the bottom is to post a working example,
                      using dummy data if your data is sensitive. Why not zip the
                      database and post it here, with a text file explaining which
                      forms and buttons are involved?..."

                      Here it is, I hope we can find an answer... They usually are staring us in the face and were too blind to see it!!

                      From within the Estimating/Invoice form, I have a few examples of data. If you click on it brings up the Checkout form. As I've explained in my previous posts, several invoices will mark() the record properly and then all of the sudden it skips a record??

                      It always seems to be the second one in the database...

                      As an example, bring up record #2, ANYONE, LISA and press on the button. The Checkout form pops up but notice the record on the invoice screen will change to YOURNAME, FIRSTNAME.

                      Now close the Checkout form and go back to the ANYONE, LISA record. You can see that it has been marked().
                      [for testing purposes I put Unmark Record button on the screen so I could unmark the record being tested without completing the invoicing process.]

                      Now, in the xbasic code in the Print invoice Button if you remove the second line: parentform.mark_record(), record #2 now stays on the form as it should??

                      Again- Appreciate the help from everyone...

                      -Hal

                      Comment


                        #12
                        RE: parentform.mark_record() fetches next record

                        Well, I thought I sent the sample file but I see now the system allows a max of a 1.0 meg file. The file I attempted to send was 1.9 meg. I'll see if I can get the working model down to these requirements tomarrow morning...

                        -Hal

                        Comment

                        Working...
                        X