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

Updating only one field when changing record

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

    Updating only one field when changing record

    Hi,

    I have a grid with 3 radio buttons and a 3 Date and Entered By fields. When a user makes a selection in radio_button_1(Stat1), i update the Date and Entered By field with the users name value. When a user makes a selection in radio_button_2(Stat2), i update the Date2 and Entered By2 field with the users name value.and so on....

    The problem with the code i am using is that if a 'different user' selects one of the radio buttons, 'all' the Date and Entered By fields change to the current user and current date. I need to prevent them from changing if its specific radio button remains unchanged.

    Code:
    select
        case DataSubmitted.Stat1="No"
    		DataSubmitted.Date1=""
    		DataSubmitted.Entered_by1=""
    	case DataSubmitted.Stat1 ="Yes"
    		DataSubmitted.Date1=date()
    		DataSubmitted.Entered_by1=session.__protected__metUserName
    end select
    
    select
        case DataSubmitted.Stat2="No"
    		DataSubmitted.Date2=""
    		DataSubmitted.Entered_by2=""
    	case DataSubmitted.Stat2 ="Yes"
    		DataSubmitted.Date2=date()
    		DataSubmitted.Entered_by2=session.__protected__metUserName
    end select
    
    select
        case DataSubmitted.Stat3="No"
    		DataSubmitted.Date3=""
    		DataSubmitted.Entered_by3=""
    	case DataSubmitted.Stat3 ="Yes"
    		DataSubmitted.Date3=date()
    		DataSubmitted.Entered_by3=session.__protected__metUserName
    end select
    Is there a command i can place in my code that will only update the radio button related fields only and leave the related untouched radio button fields alone?

    Thanks,

    Denis

    #2
    Re: Updating only one field when changing record

    I would put the date entered and user information in the Events section of the grid. Under CanUpdateRecord.
    Dan

    Dan Blank builds Databases
    Skype: danblank

    Comment


      #3
      Re: Updating only one field when changing record

      Hi Dan,

      That's exactly where it is. But i need a rule that states;

      'Only change the value of User Name and Date when the associated radio button has been changed'.

      RADIO BUTTON1 ------- USER NAME1 -------- DATE1
      RADIO BUTTON2 ------- USER NAME2 -------- DATE2
      RADIO BUTTON3 ------- USER NAME3 -------- DATE3

      e.g if i change the value in radio button 1, then only the username1 and date1 values change. If another user then changes the value in radiobutton2, then username2 and date2 change, but username1 and date1 remain unchanged.

      I hope this is possible.

      Thanks,

      Denis

      Comment


        #4
        Re: Updating only one field when changing record

        If you don't have the same field being updated again by a different person (ie, different people checking "Yes" on radio button 1 on two different days for the same record), you can do a lookup to the underlying table to see if the information has already been filled. For instance:

        Code:
        select
            case DataSubmitted.Stat1="No"
        		DataSubmitted.Date1=""
        		DataSubmitted.Entered_by1=""
        	case DataSubmitted.Stat1 ="Yes"
                                  [B][COLOR="Blue"]If alltrim(lookup(<YourTableName>,<YourRecordFilter>,"Entered_By1"))="" then[/COLOR][/B]
                                       DataSubmitted.Date1 = date()
                                       DataSubmitted.Entered_by1 = session.__protected__metUserName
                                  [B][COLOR="blue"]end if[/COLOR][/B]
        end select

        Comment


          #5
          Re: Updating only one field when changing record

          Marvin,

          Thank you for your response.

          RADIO BUTTON1 ------- USER NAME1 -------- DATE1
          RADIO BUTTON2 ------- USER NAME2 -------- DATE2
          RADIO BUTTON3 ------- USER NAME3 -------- DATE3

          There are 3 unique radio buttons, user name fields and date fields. If a user selects Yes on radio button 1 the username1 and date1 will be populated with data. However, another user may need to update radiobutton2, which will automatically update username2 and date2.

          The problem is, if the second user comes along and updates radiobutton2, unfortunately username1 and date1 also get update with the current username and date. I need to stop this from happening and have only the associated radiobutton username and date updated. If the user did change radiobutton1 then i would expect the details username1 and date1 to be updated. But if your updateing radiobutton2, then only username2 and date2 should be updated and username1 and date1 should be untouched.

          Any ideas?

          Thanks,

          Denis

          Comment


            #6
            Re: Updating only one field when changing record

            Hi Denis, You may need to attach your work. After reading this again, two different senarios pop into my head. It is a little confusing when you mention the second radio button that "all" the fields get changed. Is that all the fields for that record or all the fields in the table? Seeing what you have done may help get you a quicker response, so we aren't guessing.
            Dan

            Dan Blank builds Databases
            Skype: danblank

            Comment


              #7
              Re: Updating only one field when changing record

              Dan,

              I am basically trying to update a text field with data depending on a value selection in a radio button. However, i have 3 sets of these in one grid.

              The values i am having the problems with are;

              Code:
              DataSubmitted.Date1=date()
              DataSubmitted.Entered_by1=session.__protected__metUserName
              Reason being, that both items change when the form is updated based on the current date and username. I need to try and prevent all sets changing everytime a user updates the form. So using canupdaterecord is no doubt the place to put it, but there need to be some code in there to prevent all Date() and session.__protected__metUserName from all sets being updated.

              I dont think i can expalin this in any other way. I hope this helps.

              Thanks

              Denis

              Comment


                #8
                Re: Updating only one field when changing record

                Hi Denis,

                Like Dan said, if you can post your grid or the database as a zip file, it may help; that way we can see what you're seeing. It would help to answer some of the questions below, and others that might arise once these are answered.

                I am basically trying to update a text field with data depending on a value selection in a radio button. However, i have 3 sets of these in one grid.
                ^^Does this mean your user sees 3 sets of 2 radio buttons, for a total of 6 radio buttons? (One 'yes' and one 'no' radio button for 3 Datasubmitted.Stat fields?) Or do you have 3 radio buttons for a single Datasubmitted.stat field? The code you posted in your first post seems to indicate the first scenario.

                Reason being, that both items change when the form is updated based on the current date and username.
                ^^Does this mean that both items are changed for only a single record, or all records in the table are being changed for all fields?

                select
                case DataSubmitted.Stat1="No"
                DataSubmitted.Date1=""
                DataSubmitted.Entered_by1=""
                case DataSubmitted.Stat1 ="Yes"
                DataSubmitted.Date1=date()
                DataSubmitted.Entered_by1=session.__protected__metUserName
                end select

                select
                case DataSubmitted.Stat2="No"
                DataSubmitted.Date2=""
                DataSubmitted.Entered_by2=""
                case DataSubmitted.Stat2 ="Yes"
                DataSubmitted.Date2=date()
                DataSubmitted.Entered_by2=session.__protected__metUserName
                end select
                ....
                The problem is, if the second user comes along and updates radiobutton2, unfortunately username1 and date1 also get update with the current username and date
                ^^From all your descriptions, I still can't tell if all the fields are changing all 3 date and submitted fields everytime any field has changed- even if no one has checked any of the radio buttons at any prior point; or if it is only updating any field that has already been checked by a user in the past, and is overwriting the prior date and submitted fields.

                If it is only overwriting fields that have already been filled in previously, it is probably because your logic
                Code:
                case DataSubmitted.Stat1 ="Yes"...
                 ... 
                case DataSubmitted.Stat2 ="Yes"...
                is allowing both the current and previously changed fields to be changed every time that record has been selected. In other words, if your RADIO BUTTON1 is tied to the Stat1 field in your database, and the Stat1 field has already been saved as "yes" in your database because another user has already checked it in the past, then your grid will open with that radio button already set to "yes". When the second user checks RADIO BUTTON2, they have changed Stat2 to "yes" and Stat1 is already set to "yes" from the data saved in your database from a previous user. Therefore, both 'case DataSubmitted.Stat1 ="Yes"' and 'case DataSubmitted.Stat2 ="Yes"' are triggered, and the date and submitted fields are updated for all. That's why I had suggested using a lookup before.

                Then again, if all the above assumptions are incorrect, then the problem lies elsewhere. In which case, posting some examples or your entire zipped database will help eliminate our faulty assumptions :)

                Comment


                  #9
                  Re: Updating only one field when changing record

                  Guys,

                  I have managed to resolve this by adding a simple 'if' statement;

                  Code:
                  [B]if Args.DataSubmitted.R1.Date1 = "" then[/B]
                  DataSubmitted.Date1=date()
                  DataSubmitted.Entered_by1=session.__protected__metUserName
                  [B]end if[/B]
                  Apologies if i didnt explain my issue clearly, but thanks to everyone for their input with this one.

                  Denis

                  Comment

                  Working...
                  X