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

Control Property - Dialog Binding - NULL if blank

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

    Control Property - Dialog Binding - NULL if blank

    I have a field (N) on a dialog

    I have it set to NULL if blank
    My SQL table allows it to be blank

    When I submit, a 0 is being placed in the control (I can see it there) and a zero is being passed to my SQL table

    Why is a zero being placed in my null field?

    zero is not the same as null
    I want null, not zero
    MSQL since 2010
    A5V11 since Feb 2012

    #2
    Re: Control Property - Dialog Binding - NULL if blank

    Ok - I've done some more debugging on this issue.

    character-based control: the option to pass a null value to my SQL database works.

    numeric-based control: the option to pass a null value to my SQL database does not work; a 0 gets passed

    This is unpleasant but not dreadful when the SQL field is just a plain old field.

    BUT, when the SQL field is a foreign key, that is permitted within SQL to be null, and a 0 gets passed instead of null, then the whole query fails.

    I've written to A5 asking for a work around.

    Any suggestions from here?

    I guess I need some way to say:
    if Field1 = 0, make it null
    MSQL since 2010
    A5V11 since Feb 2012

    Comment


      #3
      Re: Control Property - Dialog Binding - NULL if blank

      I have had some success with setting variables I'm using for arguments to a null value with the null_value() function.... varName = null_value()

      I've used that in some insert queries that I write myself and it works. I wonder if you might be able to use this with the server side events of CanInsertRecord or CanUpdateRecord to override what is being submitted to the server? Seems like it would take some if statement to test if the value in the field is null first. I've tested for null values on character fields before by: If dataSubmitted.fieldName = "" then ..... but I don't know if that will work on a numerical field.

      But maybe if Alpha is submitting a zero, maybe you could do something like the following (unless, of course, you want it to submit a zero if a zero is really the value in the field):
      If data.Submitted.fieldName = 0 then
      data.Submitted.fieldName = null_value()
      end if

      If you figure out how to test for the null value of a number, please post that. I'd like to know...
      Last edited by kingcarol; 03-01-2012, 12:59 PM.
      Carol King
      Developer of Custom Homebuilders' Solutions (CHS)
      http://www.CHSBuilderSoftware.com

      Comment


        #4
        Re: Control Property - Dialog Binding - NULL if blank

        Hi Carol -

        In the Dialog component, Events.ServerSide - I do not see these as options:
        CanINsertRecord or CanUpdateRecord

        I like this, but I'm not sure where to put it:

        If data.Submitted.fieldName = 0 then
        data.Submitted.fieldName = = null_value()
        end if

        seems like I should be able to do something within the validation properties, but, I'm still too new to know where, what, how.

        I'll certainly report back when I find a solution.
        I'm sure there must be a way.
        MSQL since 2010
        A5V11 since Feb 2012

        Comment


          #5
          Re: Control Property - Dialog Binding - NULL if blank

          Oops, I didn't pay attention that you were using a dialog. Another oops... the double equals sign in that suggested code shouldn't be there.
          I haven't been working with dialogs very much yet, but seems like I remember some of the videos describing how to get in between of what was being submitted... maybe someone else knows and maybe that null_value() function will work there.
          Carol King
          Developer of Custom Homebuilders' Solutions (CHS)
          http://www.CHSBuilderSoftware.com

          Comment


            #6
            Re: Control Property - Dialog Binding - NULL if blank

            What release are you on, is it still present in the new official release?

            We reported this to A5 and got a message back from Selwyn that it would be cured in on of the next prereleases. But we havent installed the new official release either to check that...
            Ger Kurvers
            Alpha Anywhere / V4.6.1.9- Build 6488 (production) / V4.6.5.1 - 8722-5683(testing)
            Development: Mysql, windows 10 64 Applicationserver: standard on Windows server 2019

            Comment


              #7
              Re: Control Property - Dialog Binding - NULL if blank

              @Carol -
              I've watched the videos, and have things working - except for the passing of a null in the numeric control

              @Ger -
              Thank you sooo much for giving me the update - I figured I was not the only one running into this. For the moment, I'll assign a default value so control can find a linked record.

              I'm using V11 Build 2414, Trial Version
              MSQL since 2010
              A5V11 since Feb 2012

              Comment


                #8
                Re: Control Property - Dialog Binding - NULL if blank

                Marion, you can use the Server-side dialogValidate or afterDialogValidate event in a dialog, but it's a little more tricky. If the user has not edited the field, you will have to add code to tell it to change the field. Here's how you do it.

                dim ds as p = e.dataSubmitted
                If (ds.fieldName = 0) then
                ds.fieldName = null_value()
                e.dirtyColumns = word_unique(e.dirtyColumns + crlf()+ "FIELDNAME")
                end if

                The "e.dirtyColumns" is the trick to getting it to "take". Also, notice the field name is UPPER case.

                Not sure if ds.fieldName will contain a numeric or character value, but if need be, you can convert it to numeric by: val(ds.fieldName)

                Hope this helps.
                - Dan Hooley
                - Custom Desktop or Web database development -

                Comment


                  #9
                  Re: Control Property - Dialog Binding - NULL if blank

                  @Dan -

                  I like your signature line -

                  In the afterDialogValidate, should your code go before or after the line I already have?

                  I have:

                  ExecuteServerSideAction("Save Data::save")


                  I tried your code both before and after and I'm still getting a zero passed into the numeric field....


                  I have:

                  ExecuteServerSideAction("Save Data::save")

                  dim ds as p = e.dataSubmitted
                  IF (val(ds.ENTITYACCOUNTANTID) = 0) then
                  val(ds.ENTITYACCOUNTANTID) = null_Value()
                  e.dirtyColumns = word_unique(e.dirtyColumns + crlf()+"ENTITYACCOUNTANTID")

                  END IF
                  MSQL since 2010
                  A5V11 since Feb 2012

                  Comment


                    #10
                    Re: Control Property - Dialog Binding - NULL if blank

                    PS - A5 responded that this has been fixed by the latest release built (2466).
                    MSQL since 2010
                    A5V11 since Feb 2012

                    Comment


                      #11
                      Re: Control Property - Dialog Binding - NULL if blank

                      I think you need to change:

                      val(ds.ENTITYACCOUNTANTID) = null_Value()

                      to just:
                      ds.ENTITYACCOUNTANTID = null_Value()

                      the val() function will change a null value back to 0!

                      And, maybe try it in the dialogValidate event.

                      But, then, I'm not sure you can make a numeric var null??
                      I tried this in the interactive window:
                      dim x as n
                      ?x
                      = 0
                      x = null_value()
                      ?x
                      = 0

                      I still get zero!
                      - Dan Hooley
                      - Custom Desktop or Web database development -

                      Comment


                        #12
                        Re: Control Property - Dialog Binding - NULL if blank

                        I had tried it that way initially and it had not worked; that's why I added the val() around it

                        I had also tried it in the dialogValidate event (rather than the afterDialogValidate) and that had not worked either

                        But - since Ger has said and A5 has confirmed, A5 say this is fixed by release 2466
                        MSQL since 2010
                        A5V11 since Feb 2012

                        Comment

                        Working...
                        X