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

Default a date field to NULL or EMPTY...

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

    #16
    RE: Default a date field to NULL or EMPTY...

    Gabe,

    If you calculate an average, the values get summed and counted then the sum is divided by the count. If you use a zero, the sum doesn't change, but the count does, therefore the average is incorrect. A null is not counted nor is it included in the sum, so the average is correct.

    Dave
    Dave Jampole
    www.customalpha.com

    Women and cats will do whatever they want. The sooner men and dogs realize that, the happier they will be.

    Comment


      #17
      RE: Default a date field to NULL or EMPTY...

      g gabriel

      As I understand it, it won't matter which you use. It is not evaluating a blank in a numeric field from a table in an Alpha5 database even though the basic syntax makes is sound like it is. It is evaluating a 0 -zero- which is indistinguishable from a 0 that for instance I meant to put there or that was derived from an expression.

      field1 = 0, field2 = blank (no data) = 0 in a numeric field in an Alpha5 table.

      isblank(field1)= True
      isblank(field2) = True
      not.isblank(field1) = False
      not.isblank(fiels2) = False

      Something to do with the DBF backend used in Alpha5.

      Chuck

      Comment


        #18
        RE: Default a date field to NULL or EMPTY...

        No Null value can be stored in an Alpha5 db table numeric field. You can assign a variable a NULL value but you cannot store the Null value of the variable in a numeric field in an Alpha5 db. It will evaluate to 0 when stored.

        See this post

        http://msgboard.alphasoftware.com/alphaphorum/read.php3?num=15&id=12114&loc=0&offset=0&sortby=lastreply&direction=desc&thread=12114

        Given that, the point is how to distinguish that from an intended value of 0?

        Chuck

        Comment


          #19
          RE: Default a date field to NULL or EMPTY...

          I understand. In this case if you want to make the field blank, you need to blank it out with a script as you would for the date field. Use the same script:
          topparent:field_name.text = ""
          You might want to present the user with a small dialog box onArrive or onActivate asking if the value is zero or blank. If blank, run the script.
          Gabe

          Comment


            #20
            RE: Default a date field to NULL or EMPTY...

            Good example. In this case create a calc field:
            If (isblank(field_name),0,1)
            Instead of dbcount() use dbsum() of calc fields
            Base your average on the sum of the calc fields instead of the count of the fields.
            Gabe

            Comment


              #21
              RE: Default a date field to NULL or EMPTY...

              I think we are talking about different things. The text or label controls used to represent fields for display in grids or dialogs are not the same as the fields representing data structures in the Alpha5 database tables. Receiving the field value from the table you can run whatever script you want to blank the resulting display in a text or label control. However, your script cannot distinguish the data it receives from field value from the table as 0 -zero- by intent or 0 -zero- by no data having been entered.

              Similarly, you can trap a blank or NULL control field in a script prior to sending its contents to the data table because the control data type is always text (especially web controls). But even if you do, there is no way you are going to get Alpha5 to store the value as anything other than 0 -zero- in a field defined as numeric in the database table.

              You can use a script to write a value to a hidden field in the database table that will trap whether the person left the field blank or entered a 0. You can then use this hidden field to distinguish an intended NULL value from a numeric 0 value.

              Chuck

              Comment


                #22
                RE: Default a date field to NULL or EMPTY...

                You might be correct. I never tried it and as such I cannot comment on it. In this case you would have to enter the values as character then val() to numeric to do the calculations you want to do until alpha introduces null values.
                Gabe

                Comment


                  #23
                  RE: Default a date field to NULL or EMPTY...

                  Chuck, the default value for any field is "nothing," unless you specifiy a default value

                  dates will be blank, dates will be blank, and logicals will be blank

                  however - if you are viewing the data on a form, where the format is set, for example, to "$000,000.00" it will appear as $0.00, but the stored value is nothing

                  here's an example of a filter expression, that deals with blank logicals

                  "" .t. 'this catches both .f. and nothing
                  Cole Custom Programming - Terrell, Texas
                  972 524 8714
                  [email protected]

                  ____________________
                  "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                  Comment


                    #24
                    RE: Default a date field to NULL or EMPTY...

                    forgot to add this - here is a way to blank any field:

                    t=table.open("vendoraudits")
                    t.fetch_first()
                    t.change_begin()
                    fld=t.field_get("auditdate")
                    fld.blank_put()
                    t.change_end(.t.)
                    t.close()
                    end
                    Cole Custom Programming - Terrell, Texas
                    972 524 8714
                    [email protected]

                    ____________________
                    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                    Comment


                      #25
                      RE: Default a date field to NULL or EMPTY...

                      Yes, we are now talking the same problem and you are correct you would have to forgo the safety of defining a numeric field for numeric data in the table and use a text field. And you could then val() to numeric to do some math.

                      That presents potentially a bigger problem than the NULL issue in that you lose all the backend validation rules inherent to numeric data fields to protect against unwanted or improperly formatted data being entered. This is a major issue for most database developers. If you seriously wanted to use the data collected in any calculations you would have to define in code all these rules either at the front-end or during the calculation. Leaves a lot of room for error and won't change the fact that if something other than numeric data is entered, because after all it is a text field, you will have a lot of editing to do without in many cases knowing what should have been the value.

                      Chuck

                      Comment


                        #26
                        RE: Default a date field to NULL or EMPTY...

                        Yes, but try this in the interactive, one statement at a time of course....

                        t=table.open("vendoraudits")
                        t.fetch_first()
                        t.change_begin()
                        fld=t.field_get("auditdate")
                        fld.blank_put()
                        t.change_end(.t.)

                        ? t.auditdate
                        --should see = { / / }
                        t.close()
                        There can be only one.

                        Comment


                          #27
                          RE: Default a date field to NULL or EMPTY...

                          well, phooie!!
                          see what you mean

                          although it still says its blank.
                          if Alpha reads it as having no value, then I don't see that it makes any practical difference.

                          t=table.open("vendoraudits")
                          t.fetch_first()
                          t.change_begin()
                          fld=t.field_get("auditdate")
                          fld.blank_put()
                          t.change_end(.t.)
                          ui_msg_box("","" + t.auditdate + if(t.auditdate.is_blank(),"blank","notblank"))
                          t.close()
                          end
                          Cole Custom Programming - Terrell, Texas
                          972 524 8714
                          [email protected]

                          ____________________
                          "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                          Comment


                            #28
                            RE: Default a date field to NULL or EMPTY...

                            Exactly, that's why you have to design some work around so as not to take into account those records that have a "blank" value. Since alpha does not store values as "blank" or "null", you have to do that ahead of time, hence I suggested the dialog box to ask the user as a work around.
                            Gabe

                            Comment


                              #29
                              RE: Default a date field to NULL or EMPTY...

                              gabe, what's a practical example of a field with a "blank" value being a problem, since all filters, queries, expressions, etc, will see it as blank?
                              Cole Custom Programming - Terrell, Texas
                              972 524 8714
                              [email protected]

                              ____________________
                              "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                              Comment


                                #30
                                RE: Default a date field to NULL or EMPTY...

                                An on screen true false test graded as 1 point for true, -1 for false, -.25 points for not answered.

                                I believe something similar is/was used for the SAT/ACT.
                                There can be only one.

                                Comment

                                Working...
                                X