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

Reset field Value to isbalnk

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

    Reset field Value to isbalnk

    I have a field on a form where the user enters a reason for marking a record. I also have a button on this form that runs the unmark operation. When I pres the unmark button, I also want the reason field to be rid of all data. How would I delete the value in the field for each record that's marked when I run the Unmark operation?

    Thanks,

    kenn
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

    #2
    RE: Reset field Value to isbalnk

    Got it solved. Back on 4/8/99, Selwyn answered thisvery question with the following:

    there are lots of ways to do this. one easy way is the following. say the date field is called invoice_date and the name of the object on the form is also invoice_date:
    use this xbasic

    parent:invoice_Date.text = ""

    or just
    invoice_date.text = ""

    Works like a champ!!

    Thank you Selwyn!! ~(:>}

    kenn
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

    Comment


      #3
      RE: Reset field Value to isbalnk

      Not so quick Nordin, Selwyns code works great but for only one record. Kevin Coyle also submitted code:

      tbl = table.current()
      tbl.change_begin()
      tbl.date1.blank_put()
      tbl.date2.blank_put()
      tbl.date3.blank_put()
      tbl.date4.blank_put()
      tbl.date5.blank_put()
      tbl.change_end(.T.)
      parent.resynch()

      You must change the "date1 to date5" to reflect the name of your date fields in your table. Hope it works out for you.......Kevin Coyle

      It appears to me that a line of code is needed for each record where there is a value in the field to be deleted. If this is the case, one would have to take a shot at the # of lines to include and hopefully there would be no more marked records than the number of lines of code. If this is the case, surely there must be a way to clear all values for all records for that particular field when the Unmark button is pushed.

      Thanks,

      kenn
      TYVM :) kenn

      Knowing what you can achieve will not become reality until you imagine and explore.

      Comment


        #4
        RE: Reset field Value to isbalnk

        Ken,

        If I'm reading you right, you would not need a separate line in your script for each 'record'... just a separate line for each 'field' you want to blank in the current 'record'. Presumably this is known at design time, and should not be a problem. -- tom

        Comment


          #5
          RE: Reset field Value to isbalnk

          Tom,

          This is the code on the button which deletes the value. It only does one record.

          MarkReason.text = ""

          If I understand what you're saying, it should delete the value or text in the field MarkReason for all records. Yes/No?

          kenn
          TYVM :) kenn

          Knowing what you can achieve will not become reality until you imagine and explore.

          Comment


            #6
            RE: Reset field Value to isbalnk

            Ken,

            It's called a loop.

            tbl = table.current()
            tbl.fetch_first()
            while .not. tbl.fetch_eof()
            tbl.change_begin()
            tbl.date1.blank_put()
            tbl.date2.blank_put()
            tbl.date3.blank_put()
            tbl.date4.blank_put()
            tbl.date5.blank_put()
            tbl.change_end(.T.)
            end while
            parent.resynch()

            This code won't leave you on the same record where you began, necessarily. You could add code to capture the current index, set the index to record number order, capture the current record number, proccess the script for blanking, fetch the oroginal record number, and reset the index to the original.
            There can be only one.

            Comment


              #7
              RE: Reset field Value to isbalnk

              Ken,

              It's not clear to me whether you're having trouble blanking more than one field in the current record, or the same fields in more than one record.

              If you want to process all the 'marked' records you could modify Stan's idea like this:

              Code:
              tbl = table.current() ' get pointer to primary table
              if tbl.mode_get() > 0 then
                 ui_msg_box("Oops","Save pending change or enter first.")
                 end
              end if
              
              tbl.fetch_first() 
              while .not. tbl.fetch_eof() 
                 if marked() then
                    tbl.change_begin() 
                    tbl.date1.blank_put() 
                    tbl.date2.blank_put() 
                    tbl.date3.blank_put() 
                    tbl.date4.blank_put() 
                    tbl.date5.blank_put() 
                    tbl.change_end(.T.) 
                  end if
                  tbl.fetch_next()
              end while 
              parent.resynch()
              If this isn't what you need, please explain, in detail. You may safely assume we don't know the context in which your script is running, or what you're trying to accomplish.
              Thanks.

              -- tom

              Comment


                #8
                RE: Reset field Value to isbalnk

                tom,

                "It's not clear to me whether you're having trouble blanking more than one field in the current record, or the same fields in more than one record."

                The same field in more than one record. It would be the field for the records that are marked, so when the records are unmarked, the values in the MarkReason field are also deleted or the field becomes blank. Actually, the field should become blank no matter which records are marked. That way, if the user inadvertently enters data into the MarkReason field and the record is not marked, the data will still be deleted or the field will become blank/empty.

                Thanks,

                kennn
                TYVM :) kenn

                Knowing what you can achieve will not become reality until you imagine and explore.

                Comment


                  #9
                  RE: Reset field Value to isbalnk

                  Ken,

                  Modifying Tom's code, the following will unmark all marked records and blank out the Date1 field.
                  Code:
                  tbl = table.current() '--- GET POINTER TO PRIMARY TABLE
                  IF tbl.mode_get() > 0
                     ui_msg_box( "Oops", "Save pending change or enter first." )
                     END
                  END IF
                  
                  tbl.fetch_first() 
                  WHILE .not. tbl.fetch_eof() 
                     IF marked()
                        tbl.change_begin()
                           tbl.field_get(0).value_put( " " )  '--- THIS UNMARKS THE RECORD.
                           tbl.date1.blank_put()  '--- THIS BLANKS THE FIELD.
                        tbl.change_end(.T.) 
                     END IF
                     tbl.fetch_next()
                  END WHILE 
                  parent.resynch()
                  If you want to blank the field in every record in the table, simple remove the "IF marked()" (and, of course, the END IF). This will also "unmark" the records that are already unmarked but so what?

                  Note: If a table is opened with "table.open()" then "marked()" must be changed to "tbl.is_marked()". Or, better yet, just use "tbl.is_marked()" whenever you use the table mode. "Marked()" only refers to the primary table unless used with the table name as in: Marked( "mytable" ). However, this could be dangerous in Xbasic because a table opened in Xbasic might end up with a different alias name.

                  Also, when a table is opened with "tp = table.open()" don't forget to include a "tp.close()" when you're done with the table.

                  Comment


                    #10
                    RE: Reset field Value to isbalnk

                    Cal,

                    Thanks for your suggestions. I haven't had a chance to work with it but will get to it later tonight.

                    Thanks again,

                    kenn
                    TYVM :) kenn

                    Knowing what you can achieve will not become reality until you imagine and explore.

                    Comment


                      #11
                      RE: Reset field Value to isbalnk

                      Cal,

                      The code works great and does what I need to do.

                      Thanks,

                      kenn
                      TYVM :) kenn

                      Knowing what you can achieve will not become reality until you imagine and explore.

                      Comment

                      Working...
                      X