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

need help regarding mask

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

    need help regarding mask

    hello,

    I have a field ID_NO of YYMMDD-00-0000 where the year, month and day are in that order followed with numerical number 0-9 for the last 6 digits. The middle 2 digits are state number. I could use the simple mask in field rules as 000000-00-0000, but this would not prevent error while entering the information.
    Is there any other way?

    Any info and help is appreciated.

    #2
    Re: need help regarding mask

    I'd probably use 3 fields.

    In one I'd collect the "date"; no mask required.
    In the second I'd collect the "00-0000" portion with a mask.
    I'd use field rules to populate the third with a calculated expression that converts and combines the first two fields.

    I don't think you can use a mask to validate the entry of "date" values. If you collect the "date" portion separately, as a "date" type field value, Alpha will detect and block invalid inputs.

    Comment


      #3
      Re: need help regarding mask

      Hello Tom,

      Thanks for your instant help.
      I will follow your advise.

      Thanks again.

      Comment


        #4
        Re: need help regarding mask

        Hello Tom,

        I have create DOB2 field for 000000, IC1 for 00, IC2 for 0000 and IC calculated field. All are C type. I use CanEditField event ( dtoc(dob,"2-") ) on DOB field rule to get the proper date required. Then in the form, OnDepart event of DOB i use action script: get values to vc_dob, then set the value to dtoc(vc_dob,"2-"), then set value for field DOB2 with right(cdate(vc_dob),6).
        I use alltrim(dob2)+"-"+alltrim(ic1)+"-"+alltrim(ic2) into the calculated field of IC.

        Its works well. However i tried another way, creating 3 field variables on the form instead of the dob2, ic1 and ic2 on the table. I got error on the calculated IC field expression. Can this be done?
        I am trying to cut off unnecessary fields in table.

        Any help is appreciated.

        Comment


          #5
          Re: need help regarding mask

          Here's an example that may help.

          Unzip the attachment to an empty folder.

          Open the database and then FORM1.

          Let me know if you have questions.

          Comment


            #6
            Re: need help regarding mask

            Tom,

            Thanks again for prompt assist.
            Yes, that's what i was looking for, except i need to remove the first 2 digit of the year. I,ll work on it. If not I'll post question again.

            My Xbasic is very poor. I am learning from help files and forums.

            Thank you for the help.

            Comment


              #7
              Re: need help regarding mask

              Ok,

              I've extended the example to trim the YYYYMMDD to YYMMDD, and to show you how one might do this using action scripting.

              Double check the field width for the IC field I'm using it may be different from yours.

              -- tom

              Comment


                #8
                Re: need help regarding mask

                Hello Tom,

                Thanks again for the great help.
                It seems Xbasic is more simpler than the action scripts. However action scripts are much easier to understand.
                I did modify the xbasic push1 button for the :Form1:Ic.text = right(dtos(var->dob),6) + "-" + ltrim(str(var->ic1,2)) + "-" + ltrim(str(var->ic2,4))

                with :Form1:Ic.text = right(cdate(var->dob),6) + "-" + ltrim(str(var->ic1,2)) + "-" + ltrim(str(var->ic2,4))
                it work.

                I have read threads in forum, some say better use cdate than others as it will not clash with the system date?

                In the push buttons, end up with save record. Is it necessary to save record every push events? Why not let other save button do it?

                Thanks again.

                From
                Razali

                Comment


                  #9
                  Re: need help regarding mask

                  In the push buttons, end up with save record. Is it necessary to save record every push events? Why not let other save button do it?
                  No, it's not necessary to have the button push event save the record. Whether to commit the change on the button push, or at some later point is up to you. You may even decide to use a different "event" to do this work, instead of using a button push. My example was not intended to be a recommended total solution for your data entry needs, just an example of how to collect input in variables and then assign them to a table field displayed on form.

                  Comment


                    #10
                    Re: need help regarding mask

                    Dear Tom,

                    Thanks for tips and advice. Your samples are valuable especially to newer person
                    in database and alpha 5 like me. A lot i have learned from you. From proper way of setting action scripts to its xbasic comparison.

                    I certainly need it in my application.
                    Thank you very much.

                    from
                    Razali

                    Comment


                      #11
                      Re: need help regarding mask

                      Tom,

                      I need your help again.
                      How to fix the length of the variable field object in the form?

                      The format display properties only format the length of display. When typing in the field, no restriction on the length and one could make error. Not like field table, where limit the characters numbers.

                      thanks.

                      From
                      Razali

                      Comment


                        #12
                        Re: need help regarding mask

                        Check my example. When the script concatenates the variable values I include only portions of whatever string the user may have entered.

                        This situation illustrates the difficulty you will have in validating input received into raw unmasked variables. Your script should check for too few chars and also for too many. Lots of work. All of this work is avoided if you use table fields and let Alpha do the validation for you. You can do it your way, it's just going to take a lot more work. You're swimming against the tide in my opinion.

                        Comment


                          #13
                          Re: need help regarding mask

                          Tom,

                          I looked at the form again and test few times, found that the variable only accept the leading portion. I guess that's acceptable.

                          Actually, here, my customer usually presented with I.D. card with YYMMDD-12-3456 number. Not with DOB. Thus a user need to look carefully and type DDMMYY into the variable field.

                          Thus, I create 3 variables, a DOB1, IC1 and IC2, all C types. I use your action script at the OnChange event of IC2 to get text into IC table field without the date conversion part. Then on the OnChange event of DOB field, I put the conversion date get text to the DOB1 (to double check the entry).

                          Not sure if this could cause problem later.
                          People do make mistake on and off. They may type wrongly on the IC1 and IC2 part.

                          Thanks for the help.

                          From
                          Razali

                          Comment


                            #14
                            Re: need help regarding mask

                            I looked at the form again and test few times, found that the variable only accept the leading portion. I guess that's acceptable.
                            A complete solution would check the length of the string and prompt user for corrections. The difficulty is that there are several ways the user can go wrong, all of which must be trapped in your script. If it were me I would abandon the use of variables for data entry and would use table fields with field rules, instead. Doing so takes advantage of the validation code that's already built in to Alpha Five, and avoids the need to custom craft your own input validation scripts.

                            In any case good luck with your project.

                            Comment


                              #15
                              Re: need help regarding mask

                              Hello Tom,

                              I will try to use actual field then. The field rule provide a lot of functions and options.

                              When done, i post again.

                              Thanks.

                              From
                              Razali

                              Comment

                              Working...
                              X