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

need guidance please

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

  • need guidance please

    sorry, didnt know what to title this thread.

    my firm receives commissions from insurers and they may pay us a lump sum or a regular commission for a period of time.

    lump sums are no problems and at present we key on every time we receive a regular commission. i want to automate this

    i have a field to identify if the commission is regular and for the period it is paid in months (usually 24 or 48).

    what i think is a suitable solution is when a commission is added and marked as regular and the number of months added, some code runs to add 24 or 48 records to a table each one month after the other. i know how to add a single record using xbasic, but not multiple records.

    what i then need to do is to be able to cancel/delete those records which have a date in the future at any point during the 24 or 48 month period (indemnified period). reason - if a customer cancels their policy we no longer receive commission. im sure i can do this as have something similar in my app.

    this would save a huge amount of time (with one insurer we have over 500 customers receiving a small commission each month so you can imagine how time consuming this can be).

    i hope i have explained this well enough and any help appreciated, im sure i would need a loop, but i have no experience with these.

  • #2
    Re: need guidance please

    Would a better design choice be to automate the entry of 500 records each month? The script would be run monthly, using a flag field to let the script know that particular customers are inactive and should be skipped. Commission amounts would be based on the previous month's payment amounts. If so, doesn't this become a record duplication operation, once the correct subset of records is identified?

    Comment


    • #3
      Re: need guidance please

      tom,

      sounds like a better and easier idea. ill see how i get on.

      thanks

      Comment


      • #4
        Re: need guidance please

        i have put in place everything i need to ensure that records can be identified for the duplicate records operation.

        i have looked at the available operations and can only see how to duplicate a single record at a time.

        im not sure how to do this, can any one offer any ideas?

        thanks

        Comment


        • #5
          Re: need guidance please

          Not my desk right now but... I would do this in code. Open a table and filter it based on your criteria to identify the records you need.

          Then loop through the identified records creating the duplicates you need and then update the identified records to make sure they don't get processed again.

          Sorry to make this sound simplistic, but I don't have my tools at hand to point you to the right code.

          Comment


          • #6
            Re: need guidance please

            Richard, I was thinking of an Append operation, to add copies of the selected records from one table to the second. It now seems to me that I may have made an unwarranted assumption about your setup. Are you using two tables?

            David's scripted solution would work in either case.

            Comment


            • #7
              Re: need guidance please

              hi tom,

              i need to duplicate them to the same table. i thought id need to loop. not something i have done before, but suppose i got to start somewhere.

              Comment


              • #8
                Re: need guidance please

                Attached is a database with one table and one form. The table structure is simple with a field - DupID - as a logical field. Change the value of this field to T in order to have that record copied. The key to the table is set to autoincrement.

                The button on the form grabs the current table and filters it for a DupId of .T., opens another copy of the table and loops through the selected records creating new records and setting values in the 2nd copy of the table.
                The DupId of the selected records is set to .F. so they won't be copied again and the new records DupId is set to .F. also.

                This is just one way to do it. You could copy records to another temp table and then copy them back.

                Lots more to do in this code, but the basics are there.

                Comment


                • #9
                  Re: need guidance please

                  Originally posted by richard2007 View Post
                  hi tom,

                  i need to duplicate them to the same table. i thought id need to loop. not something i have done before, but suppose i got to start somewhere.
                  Append the table to itself.

                  Comment


                  • #10
                    Re: need guidance please

                    thanks once again everyone for all the help.

                    David, your code is perfect for me and has given me a better understanding of these functions.

                    really appreciate it.

                    richard

                    Comment


                    • #11
                      Re: need guidance please

                      I get so much good help here... love giving some back. Sometimes what I do is create an operation and then view the xbasic code for it - such an excellent part of Alpha5. That gives me some insight to how I might handle a situation.

                      Comment


                      • #12
                        Re: need guidance please

                        i am struggling with the filter

                        so far i have this

                        Code:
                        query.filter = "Dripreceipt = 'Yes'" + "Lapsed = .f." + "indem_enddate >= {" + ctod(date()) + "}" + "indem_first= .T." + "last_renewal <> {" + month() + "}"
                        i am looking at the help files which has given me the above, obviously i have something wrong. my error msg is 'too few parameters'.

                        Comment


                        • #13
                          Re: need guidance please

                          Maybe something like this:
                          query.filter = "(Dripreceipt = 'Yes').and.(Lapsed = .f.).and.(indem_enddate >= {" + dtoc(date()) + "})" + ".and.(indem_first= .T.).and.(last_renewal <> month(date()))"

                          The part in red is an assumption on my part. You didn't indicate month of what.

                          Have you tried what I suggested? Just run an append operation, appending the table to itself, using the filter builder for the desired records?

                          For safety purposes, duplicate the table first or backup your DB.

                          Comment


                          • #14
                            Re: need guidance please

                            i have gone about this in a different way.

                            i have added an extra field 'duplicate' and made this a calculated field in field rules with this expression.

                            Code:
                            IIF(DRIPRECEIPT="Yes".AND.LAPSED=.F..AND.INDEM_FIRST=.T..AND.INDEM_ENDDATE>=DATE(),.T.,.F.)
                            then i have changed the filter in the main code to

                            Code:
                            query.filter = "duplicate = .T."
                            Have you tried what I suggested? Just run an append operation, appending the table to itself, using the filter builder for the desired records?
                            i didnt try this yet as David's code seemed to work for me. thanks for your help

                            Comment


                            • #15
                              Re: need guidance please

                              Not sure what's the point of duplicates records? There must be a good reason for that.
                              Another very simple way to do this is to duplicate the table then create a one-to-one set.

                              Comment

                              Working...
                              X