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

Desktop Calendar caculation function?

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

    Desktop Calendar caculation function?

    Hi All,
    I am wondering if this can be done as desktop application.

    Someone rents an apartment/flat and rent starts at $250.00 and that value stored in fields called "starting_rent" and "current_rent" and the date stored in a field called "escalator_date". There is an increase that happens by 3% which is stored in a field called "escalator_rate".

    I would like the desktop application when opened to look at all "escalator dates" in a table called "tenant agreements" and pick all tenants that meet the calculation date of (escalator_date + one year) and then calculate the new rental amount by taking those records and using (current_rent * escalator_rate + current_rent) and writing that new value back to "current_rent" field only.

    Is it possible to do something like this and if so what would one do here to make it happen?

    All your help is greatly appreciated as I try to learn new things. This seems very complicated, but maybe its simple?

    Thank you,
    Paul

    #2
    Re: Desktop Calendar caculation function?

    I would like to know where you live that has rents that start at $250... I might want to move.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #3
      Re: Desktop Calendar caculation function?

      I wish too, just a number to be funny!

      Paul

      Comment


        #4
        Re: Desktop Calendar caculation function?

        Serious?
        Current rent * Escalator Rate = 250 * 3% + Current rent
        That's what you said.

        Do you mean,
        If ER date >= Lease start date + 1 year, Current Rate = Current Rate * 1.3 - assuming 3% increase.

        You will need to handle how the next year is processed.

        I would put this in an operation which ran at startup.
        See our Hybrid Option here;
        https://hybridapps.example-software.com/


        Apologies to anyone I haven't managed to upset yet.
        You are held in a queue and I will get to you soon.

        Comment


          #5
          Re: Desktop Calendar caculation function?

          pick all tenants that meet the calculation date of (escalator_date + one year)
          That sounds like a simple query.

          date() = add_years(escalator_date,1)

          would yield true or false and so select the appropriate records.


          (current_rent * escalator_rate + current_rent) and writing that new value back to "current_rent" field only
          that's an update operation on the current_rent field with the filter from above.

          I don't know about the "when opened" part. What happens if someone opens the database in the morning, closes, and opens it later in the day. Seems to me a button on a form would be a better way to trigger the process.
          Last edited by Stan Mathews; 07-26-2018, 08:35 AM.
          There can be only one.

          Comment


            #6
            Re: Desktop Calendar caculation function?

            Not sure a multiple open would cause issues Stan, if the date logic was correct. Those falling outside of the logic would get skipped?
            I suspect that he wants to preordain rent rises based on a % age value and time line.
            If he had a rent history and a rent forecast, he could plan and analyse stuff.
            Easiest way would be to have initial rate and uplifts for successive years, like +3%, + 6%, if it is linear.
            See our Hybrid Option here;
            https://hybridapps.example-software.com/


            Apologies to anyone I haven't managed to upset yet.
            You are held in a queue and I will get to you soon.

            Comment


              #7
              Re: Desktop Calendar caculation function?

              If opened a second time on the same day then the logic that chose which records to be updated would be satisfied just as it was the first time. Seems there needs to be an additional field to store last increase date and that date included in the filter and the update.

              date() = add_years(escalator_date,1) .and. last_incr < date()

              Then update

              current_rent with the expression (current_rent * escalator_rate) + current_rent or more simply (current_rent * (1+escalator_rate))

              last_incr with date().
              There can be only one.

              Comment


                #8
                Re: Desktop Calendar caculation function?

                Thanks for all the comments.
                After posting and going to bed I realized later that it could be a button that is pushed before billing each month. The escalator is constant 3% each year and it is 3% of the current rent. The starting rent is a record and maybe I could use that as Ted says and I suppose 3, 6,9,12% for each year times the starting rate. Never thought about it that way and tried the math and it works, just seems to round out lower like $10.918 becomes $10.90 (need to check)

                I guess I need to think more on this. I was giving my simplest approach I could think of, but I see possible flaws now in process as you responded, it made me think more.

                Just as a clarification on calculation
                250(the current rent)*3% being 3/100 being (.03) so
                250*.03=7.5+250=257.50 the new current rent for the year

                Thanks again!
                Paul

                Comment


                  #9
                  Re: Desktop Calendar caculation function?

                  3% of the current rate is not the same as 3, 6,9,12% for each year times the starting rate. That's the principle behind compound interest rates.
                  There can be only one.

                  Comment


                    #10
                    Re: Desktop Calendar caculation function?

                    250*1.03=257.50
                    257.50*1.03=265.225 vs 250*1.06=265.00
                    Robin

                    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                    Comment


                      #11
                      Re: Desktop Calendar caculation function?

                      Originally posted by Stan Mathews View Post
                      3% of the current rate is not the same as 3, 6,9,12% for each year times the starting rate. That's the principle behind compound interest rates.
                      I see after doing the math that we have compounding rate increases as to using the initial rate and doing 3, 6, 9, etc...
                      I have to use the compounding rate current rate * .03 for each years rent. Just the comment made me think can I do that.

                      Starting rent 100
                      first year
                      100*.03=3+100=103 Compounding rate being the base
                      second year
                      103*.03=3.09+103=106.09 Compounding rate increase .09 higher
                      or
                      100*.06=6+100=106.00
                      third year
                      106.09*.03=3.18+106.09=109.27 Compounding rate increased to .27 higher
                      or
                      100*.09=9+100=109.00

                      If I could only put $50K in a high interest account and wait 50 years!
                      Wish I had $50K to put in an account and 50 years to live!

                      Thanks for all the thoughts and comments and help!

                      Paul

                      Comment


                        #12
                        Re: Desktop Calendar caculation function?

                        You'll be OK. Robin is older than all of us.
                        See our Hybrid Option here;
                        https://hybridapps.example-software.com/


                        Apologies to anyone I haven't managed to upset yet.
                        You are held in a queue and I will get to you soon.

                        Comment


                          #13
                          Re: Desktop Calendar caculation function?

                          Hi Paul,

                          I think the function below will do what you're looking for.
                          I set it up this way to accommodate testing, but for the most part,
                          your autoexec or any other script will simply invoke this as autoIncrease(date()).

                          Hope this helps.

                          Gregg
                          Code:
                          FUNCTION autoIncrease AS C (qDate AS D )
                          	
                          dim tbl as p
                          dim tracker as n =1
                          
                          tbl = table.open("tenantAgreements",FILE_RW_SHARED)
                          
                          tbl.fetch_first()
                          
                          while .not. tbl.eof() .or. tracker <= tablecount("tenantAgreements",".t.")
                          if qDate >= addyears(tbl.escalator_date,1) then
                          tbl.change_begin()
                          tbl.current_rent = tbl.current_rent + (tbl.current_rent*tbl.escalator_rate)
                          tbl.escalator_date=addyears(tbl.escalator_date,1)
                          tbl.change_end(.t.)
                          end if
                          tracker=tracker+1
                          tbl.fetch_next()
                          end while
                          	
                          	autoIncrease = "Finished"
                          END FUNCTION
                          Gregg
                          https://paiza.io is a great site to test and share sql code

                          Comment


                            #14
                            Re: Desktop Calendar caculation function?

                            Originally posted by madtowng View Post
                            Hi Paul,

                            I think the function below will do what you're looking for.
                            I set it up this way to accommodate testing, but for the most part,
                            your autoexec or any other script will simply invoke this as autoIncrease(date()).

                            Hope this helps.

                            Gregg
                            Code:
                            FUNCTION autoIncrease AS C (qDate AS D )
                            	
                            dim tbl as p
                            dim tracker as n =1
                            
                            tbl = table.open("tenantAgreements",FILE_RW_SHARED)
                            
                            tbl.fetch_first()
                            
                            while .not. tbl.eof() .or. tracker <= tablecount("tenantAgreements",".t.")
                            if qDate >= addyears(tbl.escalator_date,1) then
                            tbl.change_begin()
                            tbl.current_rent = tbl.current_rent + (tbl.current_rent*tbl.escalator_rate)
                            tbl.escalator_date=addyears(tbl.escalator_date,1)
                            tbl.change_end(.t.)
                            end if
                            tracker=tracker+1
                            tbl.fetch_next()
                            end while
                            	
                            	autoIncrease = "Finished"
                            END FUNCTION
                            Wow, I'll give this a try and see!

                            Thank you for the code suggestion,
                            Paul

                            Comment


                              #15
                              Re: Desktop Calendar caculation function?

                              [QUOTE=datacaster;738997]Wow, I'll give this a try and see!

                              Hi Gregg and all,
                              I gave it a shot, but not sure if I have everything correct.
                              I adjusted the code as my real table is different and I posted below, so I put a button on my agreement form and pasted to an onpush action and no errors or anything.

                              I put the statement below as I couldn't find how to call a function from a button dah, so that's why nothing?
                              autoIncrease(date())

                              In code tab I used run that function and using 100 as a current rate and a date 1 year old it came up 400

                              Paul

                              FUNCTION autoIncrease AS C (qDate AS D )

                              dim tbl as p
                              dim tracker as n =1

                              tbl = table.open("tenant agreements",FILE_RW_SHARED)

                              tbl.fetch_first()

                              while .not. tbl.eof() .or. tracker <= tablecount("tenant agreements",".t.")
                              if qDate >= addyears(tbl.agreement_escalatordate,1) then
                              tbl.change_begin()
                              tbl.agreement_currentrate = tbl.agreement_currentrate + (tbl.agreement_currentrate*tbl.agreement_escalatorpercentage)
                              tbl.agreement_escalatordate=addyears(tbl.agreement_escalatordate,1)
                              tbl.change_end(.t.)
                              end if
                              tracker=tracker+1
                              tbl.fetch_next()
                              end while

                              autoIncrease = "Finished"
                              END FUNCTION
                              Last edited by datacaster; 07-27-2018, 09:58 AM.

                              Comment

                              Working...
                              X