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

Checking Existing Time/Date

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

    #31
    Re: Checking Existing Time/Date

    Yeh Peter you're right - those old habits come back to byte (hah!) me later when I don't know what it means. Comes from trying to keep long lines of code withing 80 chars so it can be read in one go.

    Comment


      #32
      Re: Checking Existing Time/Date

      Peter, those are valid questions - and could easily be handled, but go beyond the scope of my example

      I seriously question that an xdialog could be contructed to be as simple and as functional as my example, except by a very very few. I know Peter Wayne could do it, as I have seen scripts he has in xdialog as large as 100,000 lines, but I doubt there are very many developers that could do it.

      If you were constructing it for a user vs someone in payroll, the approach of course wold be much different. In this case the user is sending a fax that has his times and total hours that is entered in batch by payroll
      Cole Custom Programming - Terrell, Texas
      972 524 8714
      [email protected]

      ____________________
      "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

      Comment


        #33
        Re: Checking Existing Time/Date

        Originally posted by martinwcole View Post
        Peter, those are valid questions - and could easily be handled, but go beyond the scope of my example
        I get 'ya, Martin. Xdialog is kind of cool - lightening fast execution, "complete" control over the code/functionality, but it is soooooo much work. That's the downside. Like you, I've always sided on using forms rather than xdialog, except where I really needed it. It's just too damn labor intensive to code.
        Peter
        AlphaBase Solutions, LLC

        [email protected]
        https://www.alphabasesolutions.com


        Comment


          #34
          Re: Checking Existing Time/Date

          Originally posted by Ray in Capetown View Post
          Comes from trying to keep long lines of code withing 80 chars so it can be read in one go.
          I figured that was the case. My FoxPro guy uses another programmer from the real old days and that's how all his code is. Terse, tight and to the point. There's something to be said for that.
          Peter
          AlphaBase Solutions, LLC

          [email protected]
          https://www.alphabasesolutions.com


          Comment


            #35
            Re: Checking Existing Time/Date

            Originally posted by martinwcole View Post
            Mike,
            I chalenge you - use my program, but with an xdialog screen, and match the speed, simplicty, and functionality that mine offers, especialy as regards what Charles originally asked for, compared to yours, and record about how much time it took.
            Martin,
            Your example is very nice. No question. You said it took you an hour. I put together mine in 15 minutes.
            Challenging whether performing though xdialog and code what is needed versus building additional accessory bounded forms as your method entails is a matter of strategy and styles. As for simplicity.. what is simplicity? Having another bound form that is called and brings forth another instance of an open table I am not sure represents simplicity? Maybe I'm wrong. But my mindset is get data from tables and work locally and as much as possible and keep from holding tables open with forms that hold those tables open to as minimal as much as possible. Is that a wrong approach?
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #36
              Re: Checking Existing Time/Date

              Martin running your example it quite happily accepted a duplicate, any idea why?
              Could it be format dd/mm/yyyy
              Attached Files

              Comment


                #37
                Re: Checking Existing Time/Date

                If the data is being Faxed, it can be emailed.
                If it can be emailed it should be possible to pick out the data.
                If the data can be parsed, this whole thing could be automated.
                Except the errors that is.
                I don't buy in to the 8A and 4.15p approach.
                Going to a standard 24 hour clock would be better.

                Anyway. All we need now is Charlie's view on the suggestions.

                Edit.

                Mike's doesn't use a Date or Time format and allows dupes. It would be easier to put in 01011900 than 01/01/1900 and have the system take care of it.
                I couldn't get Martin's to work at all. Nothing could be saved. Not even a new record for a completely different person.

                And now something for you to throw custard pies at.
                Attached Files
                Last edited by Ted Giles; 04-26-2014, 04:39 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


                  #38
                  Re: Checking Existing Time/Date

                  Thanks to everyone....you too Ray. Didn't mean to upset you or ignore you. Was called away to a military training exercise on very short notice.

                  I'm back and studying!

                  Thanks,

                  Charlie

                  Comment


                    #39
                    Re: Checking Existing Time/Date

                    Read as sipping margaritas in the sun.
                    I've seen MASH!
                    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


                      #40
                      Re: Checking Existing Time/Date

                      Good one Ted! MASH seems like the good old days now!

                      Anyway, I liked all the answers and I have saved them all because I know I will need each one at some stage in my coding.

                      I ended up using Martin's code as it was more like what the user wanted. The only problem I had was modifying it a bit because I was using it in a set. I was able to change/modify it as follows:

                      Code:
                      if a_deleting_record
                      	end 
                      end if 
                      'debug(1)
                      t=table.get("timehours")
                      'if t.mode_get()=2 'entering a new record, otherwsie let through
                      if topparent.mode_get()="ENTER"
                      	id=t.empno
                      	dte=t.edate
                      	if dbcount("timehours","daily",var->id + var->dte) > 0
                      		t2=table.open("timehours")
                      		query.filter="empno=var->id .and. edate=var->dte"
                      		idx=t2.query_create()
                      		t2.fetch_first()
                      		dim global rnum as n
                      		rnum=t2.recno()
                      		idx.drop()
                      		t2.close()
                      		'if is_object("daily_entries")
                      			:timeinput:CONTROL_BROWSE1.cancel()			
                      			msgbox("Note","This employee already has an entry for that date - this will take you to that record. You may then keep the existing times or change them.")
                      			parentform.index_set()  '<=====  Needs to be modified for set
                      			parentform.find(var->rnum) '<=======Needs to be modified for set
                      		'end if 
                      	end if 
                      end if

                      My only remaining problem is returning the user to the correct former record. What would I need to do to get that part to work?

                      Thanks again to all!!!!
                      Last edited by Charles Hoens; 04-26-2014, 09:18 PM. Reason: Wrong credit!

                      Comment


                        #41
                        Re: Checking Existing Time/Date

                        Originally posted by Charles Hoens View Post
                        Thanks to everyone....you too Ray. Didn't mean to upset you or ignore you. Was called away to a military training exercise on very short notice.

                        I'm back and studying!

                        Thanks,

                        Charlie
                        Honourable reply Charlie, I note that while I was trashing you all the others backed you up. My bad.

                        Comment


                          #42
                          Re: Checking Existing Time/Date

                          Originally posted by Charles Hoens View Post
                          I ended up using Martin's code as it was more like what the user wanted. The only problem I had was modifying it a bit because I was using it in a set. I was able to change/modify it.... My only remaining problem is returning the user to the correct former record. What would I need to do to get that part to work?
                          So it seems that the table "timehours" is a child table in a set..correct? You are not going to be able to get to that child record via the record number directly, I would just filter the parent and child tables to the filter that provided you the match in the first place. I don't know about what variable types var-> id and edate=var->dte are so can't completely give filter expression reliably, but if query.filter="empno=var->id .and. edate=var->dte" worked, and assuming that the empno is the linking field, use that replacing the lines

                          Code:
                          parentform.index_set()  '<=====  Needs to be modified for set
                          parentform.find(var->rnum) '<=======Needs to be modified for set
                          with
                          Code:
                          'filter parent table
                             dim vfilter as C="empno=var->id 
                             topparent:tables:[COLOR="#FF0000"]<parent_table_name>[/COLOR].filter_expression = vfilter
                             topparent:tables:[COLOR="#FF0000"]<parent_table_name>[/COLOR].order_expression = ""
                             topparent:tables:[COLOR="#FF0000"]<parent_table_name>[/COLOR].query()
                          'filter child table
                             vfilter="empno=var->id .and. edate=var->dte"
                             topparent:tables:timehours.filter_expression =  vfilter
                             topparent:tables:timehours.order_expression = ""
                             topparent:tables:timehours.query()
                          And for the fun of it, I added the act of acquiring matching records versus just showing matching records in my example. And as for coding xdialog being so time consuming and difficult, there are so many reasons I can respond in favor of dialogs... but what I can say is we are developers and coding is our work, we do have this great tool called a Code Library, and we have the wonderful capabilities of making Preset Templates. It is a never event that I start from scratch with an xdialog.
                          Attached Files
                          Last edited by Mike Wilson; 04-27-2014, 01:13 PM.
                          Mike W
                          __________________________
                          "I rebel in at least small things to express to the world that I have not completely surrendered"

                          Comment


                            #43
                            Re: Checking Existing Time/Date

                            And as for coding xdialog being so time consuming and difficult, there are so many reasons I can respond in favor of dialogs...
                            Mike,

                            See Post #8 below by Finian.

                            http://msgboard.alphasoftware.com/al...opers&p=636972

                            In that post, Finian states:
                            Is it more work? Absolutely. My guess is that it can take three or four times as long to build the xdialog equivalent of a data entry form than in traditional Alpha.
                            As I stated in response to that post, that's the problem
                            Peter
                            AlphaBase Solutions, LLC

                            [email protected]
                            https://www.alphabasesolutions.com


                            Comment


                              #44
                              Re: Checking Existing Time/Date

                              To be honest Peter, if I wanted to code, I'd use something else.
                              I wholeheartedly agree with your comment.
                              On the other hand, there are people who feel comfortable with coding, which wasn't what AS was about.
                              If I can do it in basic AS, that's fine by me.
                              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


                                #45
                                Re: Checking Existing Time/Date

                                If that's an apology Ray - I accept it. Really though, it's no big deal. You are always kind enough to answer questions promptly and I am sure that with little to do in Capetown, you probably are standing by your email looking for replies! (heh-heh)

                                I was out to Capetown (pre-Mandela) a few times. Maybe I'll get back there again one day.

                                Just a quick thank-you to Martin Cole who was able to solve the problem with some help on the CanSave event, which was misfiring and helping me with the standard message box dialog.

                                Thanks Martin!
                                Last edited by Charles Hoens; 04-27-2014, 04:35 PM. Reason: Additional info

                                Comment

                                Working...
                                X