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

Using a check box to copy fields

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

    Using a check box to copy fields

    I am trying to copy a field from one table to another using a check box. If the box is checked, the value should be the same, if not it should be blank
    After several hours, what seems like it should be a simple procedure leaves me with no answer.
    My next thought was to build a simple table Field_1, Field_2 and the checkbox Cb.
    In form edit mode, using the x basic genie for an 'On push" event for the check box, "Fields -> Set field value"
    I end up with the xbasic code below based on using an expression.

    'Set 'Value' property of 'Field_2' in Form 'form_table1' .
    DIM form_name as c
    if is_object(topparent.this) then
    form_name = topparent.name()+".this"
    else
    form_name = ""
    end if

    DELETE expression_result
    expression_result = eval("if(cb,field_1,' ')",form_name)
    parentform:Field_2.value = expression_result

    Any thoughts on why this does not work would be appreciated.

    Larry
    Attached Files
    Last edited by Larry T; 12-18-2011, 07:24 PM. Reason: rezipped database

    #2
    Re: Using a check box to copy fields

    I downloaded the sample and got little content. It's a PITA to have to create a Db and add the table when a Zipped Db is so much easier to handle. [Tools/Zip]
    Suggest you try a Conditional Post. [Field Rules/Post/Condition]
    You won't have to use a CheckBox if you don't want to and can automate the process.
    See our Hybrid Option here;
    https://hybridapps.example-software.com/


    Apologies to anyone I haven't managed to upset yet.
    You are held in a queue and I will get to you soon.

    Comment


      #3
      Re: Using a check box to copy fields

      Looks like I was not paying attention to what was zipped up. I have corrected it. Now I also know what PITA is.

      I thought the check box would be the simplest way to accomplish the field copy as I have about seven fields on the form that I want to copy to seven different tables. The number of fields that gets copied is random so checking off the ones seemed to be the way to go.

      Larry

      Comment


        #4
        Re: Using a check box to copy fields

        I didn't realize the checkbox control had an onpush event because I've never tried it. Put the same code as the object's onchange event code and it should do what you want.
        There can be only one.

        Comment


          #5
          Re: Using a check box to copy fields

          Stan, I added a button to the form and added the script to the button and now if the check box is checked, this seems to work however it is a two step process and if you forget to press the button you have an error. I could probably figure out how to add a color to check box to indicate pushing of the copy button had occured.

          I did not understand your comment "the object's onchange event code". what is the object that you refer to?

          Perhaps the code on the check box will not function.

          Larry
          Attached Files

          Comment


            #6
            Re: Using a check box to copy fields

            Well, a little snooze time and more trials and then I stumbled onto Stan's solution of the "on change".

            Thanks for the help; now to get it to work with the set relationships.

            Comment


              #7
              Re: Using a check box to copy fields

              "I did not understand your comment "the object's onchange event code". what is the object that you refer to?"
              See attachment.
              Right click Object (just the data field not the label as well)
              Events
              OnChange.

              Fires when the data has been changed.
              Attached Files
              See our Hybrid Option here;
              https://hybridapps.example-software.com/


              Apologies to anyone I haven't managed to upset yet.
              You are held in a queue and I will get to you soon.

              Comment


                #8
                Re: Using a check box to copy fields

                Larry,

                Glad you have it working. If you think about it, does it make sense for a checkbox to have an onpush event? To diagnose what was happening I added 1 line to your existing onpush code.

                debug(1)

                This line opens the debugger window when it is encountered.

                "Pushing" your checkbox did not trigger the opening of the debugger indicating that the onpush event was not firing. The likely explanation is that there is no onpush event for a checkbox. The code behind the scenes displaying the event choices is likely generic and the onpush should have been removed in this situation.
                There can be only one.

                Comment


                  #9
                  Re: Using a check box to copy fields

                  Stan, and Larry and Ted,
                  the OnPush event for form objects other than buttons is a recent addition. I can't remember if it arrived in v9 or v10. Ok, found it in 'what's new in v9'. http://support.alphasoftware.com/Wha...Smart%20Fields

                  The Onpush event for fields is related to the 'User Defined Smart Field' feature. In order to make use of this event you need to define an icon in the properties setup tab and enable it. It is the bottom control on the setup tab. The smart field icon appears when the field (in this case a checkbox) has focus. See attached images.
                  Attached Files
                  Tim Kiebert
                  Eagle Creek Citrus
                  A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                  Comment


                    #10
                    Re: Using a check box to copy fields

                    Tim,

                    Thanks. Have you used the event? I really don't see the purpose.
                    There can be only one.

                    Comment


                      #11
                      Re: Using a check box to copy fields

                      Originally posted by Stan Mathews View Post
                      Tim,

                      Thanks. Have you used the event? I really don't see the purpose.
                      Not to any great degree. I used it once as a mechanism to fire an xdialog that was a customised lookup and another time as a help icon that launched a PDF help page. Nothing that couldn't be done some other way. I just used it 'cause it was there and figured I would see how it works.
                      Tim Kiebert
                      Eagle Creek Citrus
                      A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                      Comment


                        #12
                        Re: Using a check box to copy fields

                        Thanks guys for the input on this. I will try experimenting a bit more this weekend, probably the morning that Santa comes.
                        My revisions did not work as well as I had hoped; looks like I put the check box in the wrong table. Easy enough to fix just makes me wonder what I was thinking when I picked the wrong table. Also wonder why I could not see the "on change" option. I must have spent 20 hours trying to overcome the "on push" and if I had only gazed down a bit and looked at the other options. It sure felt good when it started doing what I was expecting of it.

                        Comment


                          #13
                          Re: Using a check box to copy fields

                          Same thing happened to me with the Security settings a few years back.
                          Coded far more than I needed to as I hadn't looked at the Table Sec Settings!
                          The Smart Field seems to need 2 clicks to activate the action. Is this supposed to happen?
                          Last edited by Ted Giles; 12-20-2011, 06:10 AM.
                          See our Hybrid Option here;
                          https://hybridapps.example-software.com/


                          Apologies to anyone I haven't managed to upset yet.
                          You are held in a queue and I will get to you soon.

                          Comment


                            #14
                            Re: Using a check box to copy fields

                            Ted, I tried the setup as Tim mentioned and it seems to function for me on one click.
                            The icon is there when you have focus and disappears when you move off. As Stan mentioned, it does not seem to serve any purpose on the form.

                            A test today of the fix for the check box in the wrong table appears to be working although it brought up another issue on a report.
                            I was using a character field previously (manual insertion of an "x" if selected) in place of the check box for indication that the field was selected. Now I get either a yes/no or T/F depending upon the check box format. Need to figure out how to insert either the X or a check mark and a blank space if not selected. Since the check box is a logical field, there does not appear to be much that you can do with an equation type setup.
                            Seems like this should have been a selection for the "Format style" in the check box properties when in the report builder mode as I would think it could be used quite frequently.

                            Comment


                              #15
                              Re: Using a check box to copy fields

                              My click through was firing an Action Script. Maybe that's why 2 clicks were necessary.
                              Must it be an [X]? wouldn't a [Tick] do the job?
                              See our Hybrid Option here;
                              https://hybridapps.example-software.com/


                              Apologies to anyone I haven't managed to upset yet.
                              You are held in a queue and I will get to you soon.

                              Comment

                              Working...
                              X