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

1 field to hold data from a field in a table linked many

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

    #16
    Re: 1 field to hold data from a field in a table linked many

    Brad,

    The script in my example also results in the LOB_active field being updated for all records. It results in a spare table which you can delete at the end of the process if you want. It would be real interesting if you have the time or inclination to see what the speed difference is between my approach and Mike's.

    Mike,

    As far as speed goes I think you could incorporate the batch_begin()... batch_end() functions as they are suppose to optimise this type of process. I think they lock the table and then only update the index after the Batch_end() rather than updating the index after each record.
    I would also place the opening and closing of table test_policy outside of tblA's while loop so you open and close it once.

    You can get rid of the leading ',' in the LOB_active field by changing the concanetation line slightly. A trick I learned from Stan Mathews
    Code:
     vcPolCat =alltrim(vcPolcat)+If(vcPolCat+"","",", ")+alltrim(tblB.lob_code)
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

    Comment


      #17
      Re: 1 field to hold data from a field in a table linked many

      Oops
      Code:
       vcPolCat =alltrim(vcPolcat)+If(vcPolCat[B][COLOR=Red]+[/COLOR][/B]"","",", ")+alltrim(tblB.lob_code)
      should be
      Code:
       vcPolCat =alltrim(vcPolcat)+If(vcPolCat[B][COLOR=Red]=[/COLOR][/B]"","",", ")+alltrim(tblB.lob_code)
      Tim Kiebert
      Eagle Creek Citrus
      A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

      Comment


        #18
        Re: 1 field to hold data from a field in a table linked many

        I'm just so dang excited about this I can't hardly sit still!!!!!!

        Tim, I'll test both. I haven't tried yours yet simply because Mike's was so easy to add to my actual application, and almost exactly like I need it. I'll get to that in a moment. First, I just want to thank you fine folks for the incredible results and solutions you've come up with. I've got the exact the solution I need. The added dialog boxes were a really nice touch too!

        There's one additional adjustment I need to make this work exactly as needed.

        In the table Policy there's a field "Active". It determines whether the policy is active or not with a simple "Yes" or "No" placed in the field. I ONLY want to pull in the LOB_Code for the Active policies (active="yes").

        In the LOB_Update code, I assume that additional line would be in this section ...

        if a5_get_records_in_query("policy","P_Code_Instar = "+s_quote(vcLink))=0 then
        GOTO NEXTCLASS
        else
        tblB = table.open("policy")
        query.filter = "P_Code_Instar = "+s_quote(vcLink)
        query.order=""
        query.options=""
        xiB = tblB.query_create()

        Not being an xbasic programmer, I can't even add a simple thing like that. I'm truly embarrassed and very humbled to all of your great work!

        Could I bother you for this last fix?

        Gentlemen, again, I can't begin to thank you enough!!!! What you've done for these programs I'm writing is beyond words! Thank you doesn't cover it!
        Brad
        Alpha5 User since Alpha4V3 ... Many years ago
        Primarily using A5V10.5
        Strictly an Action Script programmer (I don't grasp XBasic but wish I did!)
        I have commercial software for insurance agencies, churches & general businesses

        Comment


          #19
          Re: 1 field to hold data from a field in a table linked many

          Well, your very welcome.

          Yes, you assume correctly.
          Code:
          if a5_get_records_in_query("policy","P_Code_Instar = "[COLOR=Red][COLOR=Black]+s_quote(vcLink)[/COLOR]+".AND. alltrim(Active) = \"Yes\""[/COLOR]) =0 then
             GOTO NEXTCLASS
          else
             tblB = table.open("policy")
             query.filter = "P_Code_Instar = "+s_quote(vcLink)[COLOR=Red]+".AND. alltrim(Active) = \"Yes\""[/COLOR]
             query.order=""
             query.options=""
             xiB = tblB.query_create()
          I am not at a place where I can test this right now but think I got the syntax right.
          Tim Kiebert
          Eagle Creek Citrus
          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

          Comment


            #20
            Re: 1 field to hold data from a field in a table linked many

            Tim,
            I added the filter exactly as you entered it. Works perfectly. Damn, I'm so happy I can't begin to tell you! I've been fighting this problem for months! Months ago I should've just came here to the forum and asked for help.

            As I said early, thank you don't begin to cover it!
            Brad
            Alpha5 User since Alpha4V3 ... Many years ago
            Primarily using A5V10.5
            Strictly an Action Script programmer (I don't grasp XBasic but wish I did!)
            I have commercial software for insurance agencies, churches & general businesses

            Comment


              #21
              Re: 1 field to hold data from a field in a table linked many

              Originally posted by Brad Chesnut View Post
              As I said early, thank you don't begin to cover it!
              Is that an insurance pun?;)
              Tim Kiebert
              Eagle Creek Citrus
              A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

              Comment


                #22
                Re: 1 field to hold data from a field in a table linked many

                Brad, Tim:

                I implemented Tim's suggestions in the function of taking the table B open outside the loop and also use tbl.batch_begin/end() function. I loaded the example with 1000 records in the contacts table and for each contact gave them 12 policies each for a total of about 12,000 child records. Running the two versions of the function were as follows:

                ver1: Table B open inside loop & NO tbl.batch_begin/end():..............123 seconds.
                ver2: Table B open outside the loop & USING tbl.batch_begin/end():....83 seconds.

                Excellent work, Tim. Thanks for the fun exercise, Brad.

                Mike W
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment

                Working...
                X