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

distinguish between numeric 0 and null

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

    distinguish between numeric 0 and null

    I desperately need to find a way to distinguish between a numeric value of 0 (zero) and a numeric value of "null".
    I found the following disarming note on the Alpha5 help page...
    You cannot distinguish between numeric records that have no value, and those that have a 0 in them. The .DBF table format, which Alpha Five uses, has no concept of a NULL numeric value.
    ... and I also found some threads on this forum that talk about it, but I just thought "it's worth a try".

    I'm just hoping there will be someone that will tell me that is not right and there's a way around it.

    Basically, on a form I created a button to approove an Inward transaction; a transaction can be approoved only if the users entered all their charges (from another table) against it. The problem is that users are allowed to enter a value of 0 (zero) for their charges.
    When they click on the APPROOVE button, if all the charges have been entered, <APPROOVE TRANSACTION>, otherwise <CAN'T APPROOVE>.

    For example, if they entered 0 (or any other numeric value) for all charges, transaction can be approoved; if they didn't enter any value, transaction can't be approoved.

    HOW CAN I CHECK IF THE VALUE ENTERED IS A ZERO OR IF NOTHING WAS ENTERED (NULL_VALUE)?

    #2
    Re: distinguish between numeric 0 and null

    Mauro,
    I did a short search and found this thread--there are more too but this one may do for you...
    http://msgboard.alphasoftware.com/al...set+null+value

    And here is the quote from Selwyn from a link given in the above thread:
    you can use null_value() in an update operation against any data type now
    LATER: Just did a short test on what was mentioned in the thread and the test seemed to work to determine if a field was 0 or blank ("null").
    I used two numeric fields, one with a 0 value and the other with no entry (text set to ""). My button script was this for one of the fields.
    Code:
    if topparent:no2.text=""
        msgbox("This has a Null value")
     else
        msgbox("This has a 0 value")
    end if
    Last edited by MikeC; 04-15-2008, 12:45 AM.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________



    Comment


      #3
      Re: distinguish between numeric 0 and null

      Thanks Mike, I appreciate your quick reply.
      Unfortunately I can't apply the solution that you suggested. See below.

      I'm just going to explain some further details of the problem.
      Basically, I deal with 2 forms: (1)INWARDS FORM (based on INWARDS.dbf table) and (2)CHARGES FORM (based on CHARGES.dbf table). INWARDS.dbf and CHARGES.dbf are linked in a set through the INWARDS NUMBER field.
      From INWARDS FORM, users can access the CHARGES FORM (by clicking on the "ADD CHARGES" button) and enter their charges for that inward; on the CHARGES FORM, when they push the "SAVE CHARGES" button, the charges are correctly stored into CHARGES.dbf, the CHARGES FORM is closed automatically and the INWARDS FORM is reactivated.
      Now, on the INWARDS FORM, there's another button: "APPROOVE INWARD". When users click on that button, I have to check if the charges were entered for the current Inward; unfortunately I can't check through the CHARGES FORM because the form was closed and that's why I can't apply the solution suggested by Mike above.
      I can only check the CHARGES.dbf table, and apparently there's no way to distinguish between a numeric value of 0 (zero) and a numeric value of NULL.

      The solution above applies to Strings (or Characters)
      if topparent:no2.text=""
      msgbox("This has a Null value")
      else
      msgbox("This has a 0 value")
      end if
      How can I get it to work with numbers?


      NOTE: If my explanation is still crummy, let me know and I'll try to provide a graphic design of my forms.



      MAURO

      Comment


        #4
        Re: distinguish between numeric 0 and null

        Mauro,

        The No2 in my little sample script IS a numeric field but the test is done on the text value of that numeric field. As far a not being able to test on a form that is not open---if you are able to incorporate xbasic then the table the form is based upon can be opened and tested (then closed).

        For me, and most others, the best, fastest, and easiest way to help someone is if you supply a stripped down version of what you want to do with the explanation of how and what you want accomplished. I've already used up my guess!! :)
        Mike
        __________________________________________
        It is only when we forget all our learning that we begin to know.
        It's not what you look at that matters, it's what you see.
        Henry David Thoreau
        __________________________________________



        Comment


          #5
          Re: distinguish between numeric 0 and null

          For me, and most others, the best, fastest, and easiest way to help someone is if you supply a stripped down version of what you want to do with the explanation of how and what you want accomplished
          Regarding the above request, I'm scared my database is too big to upload.
          Please give me the last chance to try be more comprehensive and then I'll think about how to upload a part of my database for you to test.


          The solution below applies to fields on a form.
          if topparent:no2.text=""
          msgbox("This has a Null value")
          else
          msgbox("This has a 0 value")
          end if
          In my case, I have to deal with fields from a table (<tbl>.<field_name>)

          I can't use the ".text" property on a table field. I can only use the "str()" method but unfortunately in Alpha5 str(null) == str(0) == "0".
          (from a developer point of view this is pretty bad, str(null) should equal "" not "0").

          I honestly believe there's no way out as this is how Alpha5 handles null numeric values.
          FROM ALPHA5 V6 HELP PAGE
          "You cannot distinguish between records that have no value, and those that have a 0 in them. The .DBF table format, which Alpha Five uses, has no concept of a NULL numeric value."
          I'll probabily have to open the CHARGES form in background (somehow, maybe open it but not activate it or something like that) and then apply MIKE's solution using the ".text" property on the form fields. How painfull.

          Mike, thanks again for your patience.



          MAURO

          Comment


            #6
            Re: distinguish between numeric 0 and null

            Mauro, maybe the solution is as easy as moving the validation script to the "Save Charges" button on the CHARGES form? Seems like you could check the "text" property of each numeric field and "cancel" both the "save" and the "form close" if any are still empty.

            Comment


              #7
              Re: distinguish between numeric 0 and null

              Mauro,
              It seems that Alpha "almost" has things the way you need them but not quite---a Null value can be assigned to a numeric now as I indicated when I quoted Selwyn in a prior post but it is still treated as 0 at the table level or as a value.

              So either utilize what Tom has indicated or another way if that is not feasible would be to have a logical field that is false by default and is set to True on the first entry in the field--so if untouched you can use the logical field as a test to whether the field is blank....but with existing records this would have to be manually done.

              Or as you indicated use a hidden form that is never shown to test and then close it when done--this may be the easiest solution if Tom's idea doesn't work for you.
              Last edited by MikeC; 04-16-2008, 09:39 AM. Reason: more info
              Mike
              __________________________________________
              It is only when we forget all our learning that we begin to know.
              It's not what you look at that matters, it's what you see.
              Henry David Thoreau
              __________________________________________



              Comment


                #8
                Re: distinguish between numeric 0 and null

                Mauro,

                A shortcut might be to put in a field rule on those fields you check to insert a "0.00" (data entry/default) on a new record. Had the same problem and this is how I "fixed" it. A lot less code.
                Dave Mason
                [email protected]
                Skype is dave.mason46

                Comment

                Working...
                X