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

prevent duplicate key field in a repeating section of a UX

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

    prevent duplicate key field in a repeating section of a UX

    Hello'
    I have repeating section in an Ux. There is a field of the repeating section which must be unique .The control for this field is a Drop-down-combo-edit .Is there a practical way to do this ?
    I have tried checking the value of the filed against other rows in the change event .I can catch the duplicate field and flag it using the setCustomValidity() but I would like to put back the previous value of the field incase of duplication.
    I can not find away to to record the previous value. I tried to save the old value in Onfocus event of the field , but it does not work because the value changes when the Como-box is clicked before change & focus events.
    I apricate any help or ideas .
    Thanks ,
    Nick

    #2
    Can you use a DISTINCT?

    Comment


      #3
      When are you checking for uniqueness? (as the field loses focus or when the data is submitted ?) ?
      Are you checking against uncommitted values in the ux, or against the table of saved values ?
      Finally, I'm a bit confused. If you're using a dropdown, isn't that going to provide values that already exist ?
      Gregg
      https://paiza.io is a great site to test and share sql code

      Comment


        #4
        Thank you,
        I am checking after lose of focus and before submit. I am checking the key against both new uncommitted records and the ones that were loaded from a table .The repeating section is populated from a table, then user can update, add, or delete the rows(records) and submit
        after all rows are edited .there could be up to 4 rows in the repeating section . A field in each row is unique key and this field value must be 1 of 4 possible values , hence the dropdown selects the value for the field.
        I have all I could think of with no good solution .I can even figure out what HTML tag Alpha uses to markup the combo-box .Could not field input element does not have 'list' attribute nor I could find a <select> .
        Thanks again,
        Nick

        Comment


          #5
          the blur event (lose focus) uses the e point which should give you the ability to get the values from each of the repeating rows.
          I would expect that if you combine that with a simple database query you should be able to tell if the newest row's value is unique.

          I can help more, but would need a copy of the ux, and some sample data.
          The more information we have, the better the chances are that we can provide a solution that does what you want.

          I have to go into the office now, but seeing as how I have no life, I check the board often and work on things throughout the day.
          Gregg
          https://paiza.io is a great site to test and share sql code

          Comment


            #6
            Thanks you

            Comment


              #7
              Does that mean you got it working as expected ?
              Gregg
              https://paiza.io is a great site to test and share sql code

              Comment


                #8
                I decided I could not prevent the duplication at the time of data entry , so I would just set the costume error massage when a duplicate is entered and prevent the submission as long as the data integrity is not complete.
                Thank you & have nice day,
                Nick

                Comment


                  #9
                  I've been able to identify a duplicated key, and force the user back into that column, but I don't get the expected message in red letters.
                  Gregg
                  https://paiza.io is a great site to test and share sql code

                  Comment


                    #10
                    Can you send an image or a short video of what you are trying to accomplish?

                    Comment


                      #11
                      For myself, I like to find ways to do things people think can't be done.
                      While doing this, I thought I had things working, but apparently I'm missing something that should be executing
                      the e.javascript code.
                      Code:
                      function validate_repeatCol as p (e as p)
                      dim errorfound as n = -1
                      validate_repeatCol.hasError = .t.
                      ' debug(1)
                      'Sample validation function.
                      'Data for the current row is available in 'e.data'.
                      'For example, e.data.firstname, e.data.lastname, e.data.dateOfBirth, e.data.quantity.
                      
                      'IMPORTANT: All data values in e.data are character type. You can use the convert_type() function
                      'to convert the data to other data types. For example convert_type(e.data.quantity,"N")
                      
                      'TIP: Your Xbasic code can send a Javascript response to the browser by setting the 'e.javascript' property.
                      
                      'if e.data.repeatCol = "" then
                      ' validate_repeatCol.hasError = .t.
                      ' validate_repeatCol.errorText = "repeatCol cannot be blank."
                      'end if
                      if e.data.repeatcol = "" then
                      validate_repeatCol.hasError = .f.
                      exit function
                      end if
                      for n = 1 to 5
                      if n <> convert_type(e.data.BLURROW,"N") then
                      if eval("e.data.repeatcol"+"_a5instance"+remspecial(str(n))) = e.data.repeatCol then
                      debug(1)
                      errorfound = n
                      'e.javascript = "alert('You must choose a unique value to continue');"+"{dialog.Object}.setFocus('REPEATCOL',"+ remspecial(e.data.blurrow)+");"
                      e.javascript = "alert('You must choose a unique value to continue');"
                      ' e.javascript = e.javascript +"alert('You must choose a unique value to continue');"
                      validate_repeatCol.errorText = "Value already in row "+remspecial(str(errorfound))
                      end if
                      end if
                      next n
                      if errorfound < 0 then
                      validate_repeatCol.hasError = .f.
                      end if
                      
                      
                      end function
                      Gregg
                      https://paiza.io is a great site to test and share sql code

                      Comment


                        #12
                        Thanks, I will go over the code and see if I can
                        get it to work for me. I will also try to make video
                        explaining what I like to do.
                        Thanks again,
                        Nick

                        Comment

                        Working...
                        X