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

add_bus_days() and the holiday.dbf table in a Web App??

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

  • add_bus_days() and the holiday.dbf table in a Web App??

    Hi,
    We need to do Business days calculation in an all we are working on.
    I have read about the add_bus_days() function that uses an inbuilt holiday.dbf table the documentation says you can specify another table... But can that be a SQL Server table??
    http://wiki.alphasoftware.com/ADD_BUS_DAYS%20Function

    Do is this Desktop only? can this be used on a web app? if so where does that a_holiday.dbf table end up on the server?
    Any info on using this in a Web/Mobile app would be gratefully received.

    Thanks in advance

    Bruce

  • #2
    Re: add_bus_days() and the holiday.dbf table in a Web App??

    The function is designed to work with a dbf table and I guess that an active link table to sql table will work. Give it a try and let us know!!
    You can have many dbf tables as the function takes an argument that you can point to whatever table you like.
    The other option with SQL to use it directly is to write your own udf.

    Comment


    • #3
      Re: add_bus_days() and the holiday.dbf table in a Web App??

      Bruce,

      I'm using it in a web app but with the dbf table. I'd also be interested to know if you get it to work with a sql table.
      I had to physically copy the dbf table to my web server.

      Just as a pointer, you may already know this, but you have to set the Ignore_Holiday_Flag to any non null value to make the holiday table work.
      ie) e._set.TotalDays.value = bus_days_between(ctod(e._currentRowDataNew.StartTime),ctod(e._currentRowDataNew.EndTime),"yes")
      Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

      Comment


      • #4
        Re: add_bus_days() and the holiday.dbf table in a Web App??

        Hi Stephen,

        Thanks for your reply,
        Where does the table end up on the WAS and are you using a custom one? as I want to put a UX/grid over the table. So that the manager can manage the holidays.
        Sorry I have not used DBF or active link tables for anything I have done so it is all new stuff fro me.
        Thanks in advance.

        Thanks

        Bruce


        Originally posted by iRadiate View Post
        Bruce,

        I'm using it in a web app but with the dbf table. I'd also be interested to know if you get it to work with a sql table.
        I had to physically copy the dbf table to my web server.

        Just as a pointer, you may already know this, but you have to set the Ignore_Holiday_Flag to any non null value to make the holiday table work.
        ie) e._set.TotalDays.value = bus_days_between(ctod(e._currentRowDataNew.StartTime),ctod(e._currentRowDataNew.EndTime),"yes")

        Comment


        • #5
          Re: add_bus_days() and the holiday.dbf table in a Web App??

          Bruce,

          The developer creates the dbf automatically for you. Go to View | Settings | System | Holidays.
          Whatever you add here gets put in the dbf table.

          I'll have to look tomorrow at the exact name & location of the file and post back.
          Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

          Comment


          • #6
            Re: add_bus_days() and the holiday.dbf table in a Web App??

            The table should be in the data folder and you then use the Holiday_Table argument as shown below ( PathAlias.ADB_Path and dbf name, not just table name, e.g "[PathAlias.ADB_Path]\holiday.dbf"), otherwise the function will not find the table. It was some time ago, but from memory, even if the file is not present or incorrectly referenced the function returns a result rather an error, so be sure to test properly.

            Ending_Date as D = ADD_BUS_DAYS( Starting_Date as D, Add_Days as N [, Ignore_Holiday_Flag as C [, Holiday_Table as C ]] )
            Last edited by Garry Flanigan; 11-18-2013, 05:38 AM.

            Comment


            • #7
              Re: add_bus_days() and the holiday.dbf table in a Web App??

              hello

              create a simple table using new table
              add two fields
              holiday, character, length 16
              date, date, length, 8
              save the table as any name you want
              add some data to test
              then in the interactive window
              ?add_bus_days({some_date},some_number,"any_character_string","the table_name")
              that should give you the proper result.
              for example
              Code:
              ?{10/01/2013}+5
              = {10/06/2013}
              
              ?add_bus_days({10/01/2013},5)
              = {10/08/2013}
              
              ?add_bus_days({10/01/2013},5,"GANDHI","saphire_new_holiday")
              = {10/09/2013}
              I did not publish this yet to the server but I am sure you will be able to work on this.
              also I will try with sql table next.

              edit: I created a sql table with same two fields, non nullable and holiday being primary key
              filled in data then
              created an active link table
              and the same statement gives the proper results.
              Last edited by GGandhi; 11-18-2013, 08:47 AM.
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              [email protected]
              Skype:[email protected]
              1 914 924 5171

              Comment


              • #8
                Re: add_bus_days() and the holiday.dbf table in a Web App??

                Originally posted by GGandhi View Post
                hello

                create a simple table using new table
                add two fields
                holiday, character, length 16
                date, date, length, 8
                save the table as any name you want
                add some data to test
                then in the interactive window
                ?add_bus_days({some_date},some_number,"any_character_string","the table_name")
                that should give you the proper result.
                for example
                Code:
                ?{10/01/2013}+5
                = {10/06/2013}
                
                ?add_bus_days({10/01/2013},5)
                = {10/08/2013}
                
                ?add_bus_days({10/01/2013},5,"GANDHI","saphire_new_holiday")
                = {10/09/2013}
                I did not publish this yet to the server but I am sure you will be able to work on this.
                also I will try with sql table next.

                edit: I created a sql table with same two fields, non nullable and holiday being primary key
                filled in data then
                created an active link table
                and the same statement gives the proper results.
                Ghandi,

                Thanks, this is great! I'm going to try and get mine changed from dbf to sql.


                EDIT:
                The auto generated Alpha dbf table is called a_holidays.dbf
                It resides in C:\Users\Administrator\AppData\Roaming\Alpha Software\Alpha Anywhere Server Version 12 on the development workstation.

                Stephen
                Last edited by iRadiate; 11-18-2013, 02:23 PM.
                Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

                Comment


                • #9
                  Re: add_bus_days() and the holiday.dbf table in a Web App??

                  Originally posted by iRadiate View Post
                  Ghandi,

                  Thanks, this is great! I'm going to try and get mine changed from dbf to sql.


                  EDIT:
                  The auto generated Alpha dbf table is called a_holidays.dbf
                  It resides in C:\Users\Administrator\AppData\Roaming\Alpha Software\Alpha Anywhere Server Version 12 on the development workstation.

                  Stephen
                  This file is probably hidden from view
                  So it will easy to our own table and not to worry about
                  View settings holiday etc.,
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  [email protected]
                  Skype:[email protected]
                  1 914 924 5171

                  Comment


                  • #10
                    Re: add_bus_days() and the holiday.dbf table in a Web App??

                    Originally posted by GGandhi View Post
                    This file is probably hidden from view
                    So it will easy to our own table and not to worry about
                    View settings holiday etc.,
                    Ghandi,

                    Yes it is hidden and unless you copy it to the web server, the server will yell that it can't find it. It doesn't seem to go across with publishing support files.
                    Agreed, it would be much nicer to have a sql table. I'm working on this.
                    Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

                    Comment


                    • #11
                      Re: add_bus_days() and the holiday.dbf table in a Web App??

                      I created a SQL table called "holidays" but when I try to use it, an error window says it can't find the table. It is looking for "holidays.dbf"
                      Running this code: e._set.TotalDays.value = bus_days_between(ctod(e._currentRowDataNew.StartTime),ctod(e._currentRowDataNew.EndTime),"yes","holidays")

                      Holidays.jpg

                      I think you are limited to dbf for the holiday table
                      Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

                      Comment


                      • #12
                        Re: add_bus_days() and the holiday.dbf table in a Web App??

                        Hi All,
                        Yeah I don't think it will work ... nicely
                        I asked the question to Alpha and Selwyn has replied.
                        it would be quite easy to make the add_bus_days() function reference a sql database table that was configured in the 'project propetries'.
                        i will add this to my to do list.
                        So no timeline but it is on the list so maybe in the not to distant future this will be dealt with.
                        Thanks to everyone fro looking into this for me.

                        Bruce
                        Last edited by kiwibruce; 11-18-2013, 09:21 PM. Reason: typo

                        Comment


                        • #13
                          Re: add_bus_days() and the holiday.dbf table in a Web App??

                          Originally posted by kiwibruce View Post
                          So no timeline but it is on the list so maybe in the not to distant future this will be dealt with.
                          Thanks to everyone fro looking into this for me.

                          Bruce
                          Hi Bruce,

                          I can confirm that this is now indeed working in the latest Pre-Release build 1823_4231.
                          I created a simple table in SQL called holidays with holidayid, holiday and date.
                          My TabbedUI has a simple grid where I can update the holidays table:

                          Holidays Grid.jpg

                          I have another table where the user inputs a StartTime and EndTime and I calculate the number of days between excluding weekends and dates in the holidays table using the bus_days_between xbasic function. My database is called Engineering and the date field in the holidays table is called date. The syntax is as follows:

                          Code:
                          e._set.DaysAway.value = bus_days_between(ctod(e._currentRowDataNew.StartTime),ctod(e._currentRowDataNew.EndTime),"yes","{connectionstring: 'Engineering', table: 'holidays', column: 'date'}")
                          So, here you can see the user has selected 8 days from Dec 23 to Dec 30 where there are 2 weekend days and 2 holidays (Christmas Day & Boxing Day), and the result is 4 days.

                          Calc Days.jpg

                          Beware that this is the Pre-Release not the official release !!!
                          Thanks Bruce for asking about this and many thanks to Selwyn for making it happen. Although an old function, the ability to use this with SQL is incredibly useful for me. I use this in many reports also.
                          Alpha Anywhere v12.4.6.3.0 Build 7582-5569 IIS v10.0 on Windows Server 2019 Std in Hyper-V

                          Comment

                          Working...
                          X