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

Repeat an append operation until zero records

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

    Repeat an append operation until zero records

    I think the solution to my problem will be easier than me trying to explain it! But here goes. Also, I have no knowledge of programming which is why I love Alpha 5.

    I am developing a property rental database.

    Reccuring_table has information about the rental, i.e. tenant_id, period (calendar monthly etc), rent_amount (amount of the rent) and due_date.

    When a new tenant is created, the above fields are appended to reccuring_table.

    I then have another table, rentals_due. This table will contain all the rental due dates for the tenant. When a new tenant is created, the first rental is appended to start from the start date.

    I then create an append operation from reccuring_table to rentals_due that does the following:
    • Only appends records where due_date + 1 month < today (so that future rents are not put in as they are not due yet)
    • If rent is due, append the record from reccuring_table to rentals_due table.
    • When appending, add 1 month to the date in recurring table
    • Also when appending, add 1 month to the date in the rentals_due


    This works well and I thought I could run the operation every time the database is open for example.

    However, there is a problem:

    Firstly, if I didn't open the database for three months say (which is unlikely), it would only add one month to the rentals_due, so two months would not show (unless I opened the database another two times!)

    Secondly, If I want to add a tenant who is already in a property and has been for say 2 years, I would add the tenant, but then I would have to run the append operation 24 times to bring it up to date.

    All I need is a way of repeating the append operation until records to append = 0, then it would stop. This too would fix the problem of not opening the database often as it would always bring the rentals_due table up to the current date.

    Any help would be greatly appreciated (I am also interested if there is an easier way to do what I suggest)

    Many thanks in advance

    Adrian

    #2
    Re: Repeat an append operation until zero records

    Do you use a lease(like for a year)?
    Dave Mason
    [email protected]
    Skype is dave.mason46

    Comment


      #3
      Re: Repeat an append operation until zero records

      Originally posted by DaveM View Post
      Do you use a lease(like for a year)?
      Yes, normally 3 or 6 months, however that does not really matter because the lease is a 'minimum' term. Often, on the same lease a tenant can be in the property for several years. Here in the UK, a lease automatically rolls on forever until either party gives notice to leave.

      Many thanks

      Adrian

      Comment


        #4
        Re: Repeat an append operation until zero records

        I would suggest you post the database for us to look at. I think there are other/better ways to do what you need, but seeing what you are doing now would give a hint as to what is needed. You can put some sample data in and take out the good stuff if you want(and i suggest it).

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

        Comment


          #5
          Re: Repeat an append operation until zero records

          Ok, thank you, I will do that. I have just started developing it, so I will do so in a few days when I've got some other things done to make it clearer to see. I have developed another database in Alpha 5 so I should be able to get the basics done fairly quickly.

          Currently I am using access to do this, which has worked for several years but typical Microsoft it is too unreliable and far too complicated.

          How I programmed access is as follows:

          As described above, there is tenant database with tenant_id, start_date, rent, period etc.

          Then, in order to calculate the amount due on any given day, it simply calculates the number of months between start_date and date() and then multiplies this by rent. For example start date is 1/1/07 and rent is 400.

          So if today is 29/9/07 (in US format that's 9/29/07) it calculates that there are 9 months between start_date and date() and multiplies that by 400 (the rent).

          This provides an amount due figure of 3600

          Then it takes a sum() of all amounts paid.

          Then a simple total amount due - sum() amount_paid, produces how much the tenant owes today.

          This system works very well and is reliable, but trying to do a report of when rent was due, how much was paid etc. is virtually impossible. In order to produce a report, I have a really complicated export to excel which then has loads of complicated formulas to work out rent due and rent paid.

          When I need to go to court on the grounds of rent arrears, I have to produce an easy to understand rent statement which the judge can understand. This could take the form of a common invoice statement as essentially that is all it is, a reccuring invoice system with payments. In addition, tenants always need an easy to understand statement.

          This is why I am trying to change the system.

          The amount paid would obviously come from it's own table and the amount due and arrears would be calculated from simple sum() functions.

          To add further problems, some rents are weekly, some for weekly, some monthly and some quarterly! Although, that is a simple if(period=weekly then add 7 days, if(period=monthly, add 1 month)) and so on...

          I am very grateful for the assistance, I just can't seem to get my head round this one... I should have concentrated more in maths at school!!

          Many thanks and I will come back in a few days with a skeleton database.

          Adrian

          Comment


            #6
            Re: Repeat an append operation until zero records

            I managed to get a skeleton database running quicker than I thought and it is attached.

            I hope it is all self explanatory but anything you are unsure about, please let me know. I check emails regularly.

            Many thanks for your assistance, I am truly grateful.

            Adrian

            Comment


              #7
              Re: Repeat an append operation until zero records

              Sorry, I should have said. Open Main Menu form to start.

              When looking at tenants, you will see that I have added a tenant who started in 2006 but I have not pressed the button to append the recurring table. This where the key problem lies, the button (or link it to opening of database) will need pressing 12 or so times to bring the rentals into line with the current date.

              Many thanks

              Adrian

              Comment


                #8
                Re: Repeat an append operation until zero records

                Just in case anyone is reading this thread and wonders if the problem was fixed, I just figured out how to do it.

                Basically I added a new field into the "recurring_table" that contained the julian date of when next rent due.

                Then a simple script would only repeat the append operation if the minimum value of this field was not >= the julian date of today.

                (The reason I created a julian field was because it seemed difficult to find the minimum value of a date field whereas a julian date is just a number).

                Therefore now, the script will keep repeating the append operation until no more rents are due, then stop without being in an endless loop.

                Comment

                Working...
                X