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

changing character field to time field

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

    changing character field to time field

    I have an old dBase file with a few time fields in it. I opened the file with Alpha five and discovered the data in the time fields had changed. First of all, Alpha five change time fields to character fields containing eight digits. The first four digits seem to display military time and the last four digits are all zeros.
    1530000 instead of 3:30pm
    I need these fields to be timed fields showing actual time.
    How do I correct this?
    Thanks
    There is no love sincerer than the love of food.
    George Bernard Shaw

    #2
    Re: changing character field to time field

    ?ctot(mask("1530000"," :"))
    = 03:00:00 00 pm

    Comment


      #3
      Re: changing character field to time field

      Gabriel, what you have displays as "3:00" PM -- is there a reason why it's not showing as "3:30" PM? Just curious, because I'm going to have to do a similar conversion soon and have had no experience with this yet...

      Comment


        #4
        Re: changing character field to time field

        Originally posted by G Gabriel View Post
        ?ctot(mask("1530000"," :"))
        = 03:00:00 00 pm
        Gabriel,
        did you run this in IW. I get something different.

        ?ctot(mask("1530000"," :"))
        = 01:00:00 00 am

        I think there are some spaces missing. The result should be 3:30, not 3 o'clock. So wouldn't it be this?

        ?ctot(mask("1530000"," : "))
        = 03:30:00 00 pm
        Last edited by Mike Wilson; 03-04-2007, 07:59 PM. Reason: spaces deleted on posting
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


          #5
          Re: changing character field to time field

          The system is removing the proper spaces when posting to the MB. Don't know why. The red "X"'s below each represent a space.

          ?ctot(mask("1530000","XX:XX"))
          = 03:30:00 00 pm
          Mike W
          __________________________
          "I rebel in at least small things to express to the world that I have not completely surrendered"

          Comment


            #6
            Re: changing character field to time field

            Originally posted by Mike Wilson View Post
            The system is removing the proper spaces when posting to the MB. Don't know why.
            It removes them unless you tell it not to



            Code:
             
            ?ctot(mask("1530000","  :  "))
            = 03:00:00 00 pm
            Code segments are taken literally. Most anything else is parsed by html which collapses the whitespace.
            There can be only one.

            Comment


              #7
              Re: changing character field to time field

              Stan,
              I'm certain you speak fluent html and whisper sweetness to the system which responds to your appealing nature, and doesn't mess with your spaces. Maybe someday I might be able to also, and my spaces won't be rejected, like yours aren't. I am proud to say, though, that I am able to get the code to resolve to the correct answer of 3:30, and not to 3:00. I don't know how you get your unit to keep the spaces, but your unit is spitting out the wrong answer.

              ?ctot(mask("1530000","_ _ :_ _"))
              = 03:30:00 00 pm
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


                #8
                Re: changing character field to time field

                Mike:
                The system is removing the proper spaces when posting to the MB. Don't know why. The red "X"'s below each represent a space.
                That's because I didn't enclose it in a code. I know better, I should have. Trying to hurry up and go to the Gym. You should do that too!

                Shawn:
                Watch the number of spaces, 2 before the colon, two after.
                Code:
                ?ctot(mask("1530000","  :  "))
                = 03:30:00 00 pm

                Comment


                  #9
                  Re: changing character field to time field

                  I appreciate your responses to this issue but I'm afraid that your solutions, while appearing simple, are a little over my head. I know nothing about writing code in alpha five. I am in the process of converting databases that I created in Lotus Approach into Alpha Five databases. I have also created a few databases from scratch and I have been pleased with the results. I am familiar with database principles but not all the workings of Alpha five.
                  There is no love sincerer than the love of food.
                  George Bernard Shaw

                  Comment


                    #10
                    Re: changing character field to time field

                    Originally posted by Mike Wilson View Post
                    Stan,
                    I'm certain you speak fluent html and whisper sweetness to the system which responds to your appealing nature, and doesn't mess with your spaces. Maybe someday I might be able to also, and my spaces won't be rejected, like yours aren't. I am proud to say, though, that I am able to get the code to resolve to the correct answer of 3:30, and not to 3:00. I don't know how you get your unit to keep the spaces, but your unit is spitting out the wrong answer.

                    ?ctot(mask("1530000","_ _ :_ _"))
                    = 03:30:00 00 pm
                    Don't know much about html at all. Just meant to point out that

                    Code segments are taken literally. Most anything else is parsed by html which collapses the whitespace.
                    So if you use the # above the posting area to specify that a section of your post is to be interpreted as code, anything you type inside that code segment here is taken literally and spaces are preserved.

                    Didn't pay any attention to what I cut and pasted inside the code delimiters, sorry to mislead.
                    There can be only one.

                    Comment


                      #11
                      Re: changing character field to time field

                      Patrick Pierre-Jerome:
                      I am going back to you roriginal question as to how to change the character field to a time field:
                      1-Leave the character field alone for now.
                      2-Go to the table, edit the structure of the table, add a new field, let's call it T_field, make it a "Time" field".
                      3-Save & Close the table
                      4-Go to "operation" tab, choose new, use the Genie, choose "Update way at the bottom and from the right pane choose the table
                      5-When you get to the fields mapping, for the new field "T_field", use an expression to update the field. Use that expression: ctot(mask(Old_Field," : ")) as written above.
                      6-Finish and run the update operation
                      7-Now the new field should have the new values
                      8-Go back to table, edit structure, delete the undesirable field, rename the new field to the name of the deleted field, save the new table.

                      Comment


                        #12
                        Re: changing character field to time field

                        Gabriel,
                        Kudos for getting back to the original point. However if you follow your directions, it leads to nowhere. I see no capacity to select the TIME field created for an update in either the Date/Time tab or the General tab.

                        So amending your instructions.

                        Patrick,
                        Try this:
                        1-Leave the character field alone for now as Gabriel said.
                        2-Go to the table, edit the structure of the table, add a new field, let's call it ST_field, make it a "Short_Time" field. Save & go to FIELD RULES.
                        3 - Select the new field just created- ST_field. Under the Field Types tab choose 'Calculated"
                        4-Within the 'Calculated field expression, put in ctot(mask(Old_Field," : ")) with two spaces as written above. Save and exit to the control panel.
                        6-Highlight the table and right-mouse click. Choose Utilities> Recalculate Calc Fields. This will populate the new field
                        7-Return to Table> Design >Field rules and change the field back to User Entered.

                        Good luck
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: changing character field to time field

                          Mike;
                          Good catch. I hardly ever use any Genies for anything anyway,so these were done from memory not knowing that alpha does not have much respect for "Time". Something like this, I would typically do with xbasic.

                          Actually, I don't fault alpha, "Time" fields are a very weired animal.

                          Comment


                            #14
                            Re: changing character field to time field

                            Mike
                            I followed your instructions and got a bittersweet result. The sweet result is that the new field is now populated with time values. The bitter result is that all the time values display "03:34 pm".
                            As I mentioned before, the character field contains eight digits. The first four digits appeared to be military time followed by four zeros.
                            For example:
                            14300000 is supposed to be 2:30 pm
                            17000000 is supposed to be 5:00 pm
                            11000000 is supposed to be 11:00 am
                            I greatly appreciate your help in getting me this far. That goes for you to Gabriel.
                            Obviously there is something missing. I will try to keep plugging away at it.
                            Let me know if you come up with something.
                            Thanks
                            There is no love sincerer than the love of food.
                            George Bernard Shaw

                            Comment


                              #15
                              Re: changing character field to time field

                              The new field actually displays "03:34:25 62 pm". I used the format tab in the properties box to show only hours and minutes.
                              There is no love sincerer than the love of food.
                              George Bernard Shaw

                              Comment

                              Working...
                              X