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

update Logical Field from Date Field

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

    update Logical Field from Date Field

    Hi all, I found some threads about updating fields with info from another, but not what I am trying to do. I have a table, imported from Access. I actually ziped the table in a previous thread, msg id 79745, a couple of days ago. In this table are two fields, date_close (d) and inactive (l). I have 2300+ records. Would like to run an update to mark the inactive field to .t., which by the way is a checkmark box, based on the file being closed. any suggestions, tks jb

    #2
    RE: update Logical Field from Date Field

    ...based on the file being closed.

    If you want the inactive field set a certain way when the close date is within a certain date range, check out the Between() function. It will accept date arguments and it returns a logical value. I assume you know the basics of how to set up an update operation?

    Steve

    Comment


      #3
      RE: update Logical Field from Date Field

      Hi, thanks for the reply, here is what I tried, placing a tmp btn on form. The form is based on set with the topparent being wclients. I get an argument is incorrect daya type, which is true as one is date and other is logical, I'm just grasping at straws here to get something working. I read a lot of threads about between(), tried them interactivly, no results. I'll go to learningalpha and see if there is something there. tk jb

      tbl = table.open("wclients")
      query.filter = "fileopened = '01/01/1996'"
      query.filter = "file_close = '12/31/2004'"
      query.order = ""
      query.options = ""
      indx = tbl.query_create() (Bombs Here)
      update.fields = 1
      update.field= "inactive"
      update.expr = ".t."

      Comment


        #4
        RE: update Logical Field from Date Field

        you can use update operation.

        put condition:
        fileopened"={01/01/1996} and file_close"={12/31/2004}

        put field:
        inactive

        put expression:
        .T.
        :) Romy

        Comment


          #5
          RE: update Logical Field from Date Field

          put condition:
          fileopened={01/01/1996} .and. file_close={12/31/2004}
          :) Romy

          Comment


            #6
            RE: update Logical Field from Date Field

            John,

            If fileopened and file_Close are date type fields, that explains your problem. You are using them as character fields. Moreover, your second assignment of query.filter merely overwrites the first. They should be combined with an .AND. operator between them.

            So if these are date fields give this a try:

            query.filter = "fileopened={01/01/1996} .AND. file_close={12/31/2004}"

            I'm a little surprised if you want the query based on two date fields having two specific dates rather than, say, having one date field being between two specific dates. Let us know the specifics of what you want.

            Steve

            Comment


              #7
              RE: update Logical Field from Date Field

              For later usage if you want to know why your attempt didn't work...

              A second assignment to a variable is not additive, it replaces the value. So

              query.filter = "fileopened = '01/01/1996'" - first assignment
              ? query.filter
              = "fileopened = '01/01/1996'"

              query.filter = "file_close = '12/31/2004'" - second assignment
              ? query.filter
              = "file_close = '12/31/2004'"

              To combine filter criteria use

              query.filter = "fileopened = '01/01/1996'"+".and."+"file_close = '12/31/2004'"
              ? query.filter
              = "fileopened = '01/01/1996'.and.file_close = '12/31/2004'"


              But since I believe you mentioned that the fields were dates, you probably wanted to use

              query.filter = "fileopened = {01/01/1996}"
              ? query.filter
              = "fileopened = {01/01/1996}"

              query.filter = "file_close = {12/31/2004}"
              ? query.filter
              = "file_close = {12/31/2004}"

              Combined as
              query.filter = "fileopened = {01/01/1996}"+".and."+"file_close = {12/31/2004}"
              ? query.filter
              = "fileopened = {01/01/1996}.and.file_close = {12/31/2004}"


              The rest of your script wouldn't have worked either but you can now see a way to construct proper filter expressions.

              I think I remember a good article on www.learn alpha.com but your can also good information in the help files.
              There can be only one.

              Comment


                #8
                RE: update Logical Field from Date Field

                Didn't mean to repeat your excellent advice, just took me longer than you to compose a response.
                There can be only one.

                Comment


                  #9
                  RE: update Logical Field from Date Field

                  Thanks guys, sorry did have the .and. between dates, caused a little confusion. The replies did twig one thing, I really didn't need the start date, only needed to change the inactive field to .t. if there was a closed date. managed to do what I needed through an operation.. I did look at Dr. Wayne's site and found some good articles on between dates. thank again to all. jb

                  Comment


                    #10
                    RE: update Logical Field from Date Field

                    Hi again, the update worked fine in the table, however, when I look at my form, the inactive field is blank. The field on the form is a checkbox, if I had left the field as t or f would it have made a difference, if so, then how can I get my checkbox to show an X. thk again jb

                    Comment


                      #11
                      RE: update Logical Field from Date Field

                      in form design model, check the property of inactive, if it is check-box type it will work. see attachment
                      :) Romy

                      Comment


                        #12
                        RE: update Logical Field from Date Field

                        Hi, that's my problem, I Have the inactive field on the from, set to check box, when the update ran it didn't check the boxes accordingly. I ran the update on the table and the results are correct, .t. if there was a end date and .f. if there wasn't. The form just shows a blank box.?? jb

                        Comment


                          #13
                          RE: update Logical Field from Date Field

                          if it is .f., it will blank box, if it is .t., it will be checked. Did you check the property of inactive field which is check-box type?
                          :) Romy

                          Comment


                            #14
                            RE: update Logical Field from Date Field

                            Hi Romy, not my finest hour, the form is based on a set, another tbl in the set also has an inactive field. Guess which one it was set to, duh.. Everying as it should be, thanks for help. jb

                            Comment

                            Working...
                            X