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.
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.
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
martin_w_cole@msn.com
____________________
"A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw
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.
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"
Martin running your example it quite happily accepted a duplicate, any idea why?
Could it be format dd/mm/yyyy
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.
Last edited by Ted Giles; 04-26-2014 at 05:39 AM.
Ted Giles
Example Consulting - UK.
http://ec12.example-software.com// See our site for Alpha Support, Conversion and Upgrade.
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
Read as sipping margaritas in the sun.
I've seen MASH!
Ted Giles
Example Consulting - UK.
http://ec12.example-software.com// See our site for Alpha Support, Conversion and Upgrade.
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 at 10:18 PM. Reason: Wrong credit!
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
withCode:parentform.index_set() '<===== Needs to be modified for set parentform.find(var->rnum) '<=======Needs to be modified for set
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.Code:'filter parent table dim vfilter as C="empno=var->id topparent:tables:<parent_table_name>.filter_expression = vfilter topparent:tables:<parent_table_name>.order_expression = "" topparent:tables:<parent_table_name>.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()
Last edited by Mike Wilson; 04-27-2014 at 02:13 PM.
Mike W
__________________________
"I rebel in at least small things to express to the world that I have not completely surrendered"
Mike,And as for coding xdialog being so time consuming and difficult, there are so many reasons I can respond in favor of dialogs...
See Post #8 below by Finian.
http://msgboard.alphasoftware.com/al...opers&p=636972
In that post, Finian states:
As I stated in response to that post, that's the problemIs 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.
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.
Ted Giles
Example Consulting - UK.
http://ec12.example-software.com// See our site for Alpha Support, Conversion and Upgrade.
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 at 05:35 PM. Reason: Additional info
Thanks for that link. I remember reading that link. Very good insight. I would love to debate this with you, but beyond the scope of this thread I'm afraid. There is one aspect of xdialog that is unattainable with standard forms. The capabilities to generate a user interface dynamically and that draws data from many tables that are not bound. I just posted an example of a dynamically generated xdialog presenting the user with 37 combo boxes for result selection.
http://msgboard.alphasoftware.com/al...cept-selection
I'm hard pressed believing this could be built with the functionality present in one script faster and easier as a form, fixed-object-based interface. But I'm open to be wrong. It was said very few people could do this. If that's the argument I have no defense. But I really consider myself as having just average development skills.
Mike W
__________________________
"I rebel in at least small things to express to the world that I have not completely surrendered"
Mike, if you were entering say 250 entries every day, (and other duties as well,) and had to use a calendar vs 8A or 7.30p, you would go for the latter very quickly. It is much much much faster and simpler.
Cole Custom Programming - Terrell, Texas
972 524 8714
martin_w_cole@msn.com
____________________
"A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw
Mike,
1. A form can host all the variables needed for input, as you know. Those variables can be inserted in as many tables(no association needed) as one wants. That is for one of the parts.
2. via a script(s) all the data needed can be read from tons of tables and placed in variables. These can be shown on the above form.
I use a great deal of dialog and it has it's place. It is time consuming to work with, but most of the same can be done in a form much more quickly.
I do calculations on a very large scale in one app and on the form are around 40 variables. The users does not know the difference. Once the math is complete and saved, the data is dispersed over several tables. Some of these are in the set and other tables are unassociated. It works real slick, but took some work.
Point is: It would have taken much more time to do this in xdialog if it is possible.
100% vars aaaaaaa.png almost all vars aaaaaab.png
As far as keeping up with time and I have a vast amount of experience with that from multiple companies.
Some of those companies had very strange ways of getting the hours from employees. The best, of course, is a time clock. A bit hard to mess it up, but the clocking machine is not always available.
Even the most weird were smart enough to use the cards and let them be hand filled. This laid the responsibility and the means for employees to keep their hours straight. Turned in one time a week and then checked, added where the hours are actually written on the cards. The input becomes easy and far fewer mistakes. There is even the ability to differentiate times spent on different paying contracts, etc as needed for later billing.
I have had to explain some of this to employers as a part of my job many times, but never had one complain once they started using the system.
Faxing in once a day when you have a large number of employees and inserting daily is time consuming and fraught with errors on a whole.
I know that convincing employers that their methods could be better is a hassle, but at least I feel better by letting them know if there is a better way.
In defense of xdialog, as Mike points out, it a poor boys client server. It is very fast, and as Mike points out, does not leave tables open. So, all things being equal, if one has the skill to produce an "embedded browse" - type interface for fast entry, and to handle the issue Charles originally described, I would say go for it. Unfortunately, I do not have those skills, so I use forms.
But an app, in my opion, should be designed for speed and simplicity of entry, and very user friendly.
Dave - I wrote a time clock several years ago that is built in to the main app - they clock in when coming to work, and then out and in for lunch, breaks, etc. It calculates payrol hours, over time, vacation, sick leave, bereavement - and keeps track of unused vacation and sick leave. But it does not calcualate dollar amounts. They take a report and then enter into quick books. It is currently used by three different companies.
Cole Custom Programming - Terrell, Texas
972 524 8714
martin_w_cole@msn.com
____________________
"A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw
Martin,
I still have one dos app that does the same as you wrote being used to date. It also does the complete payroll without quickbooks(Meaning dollars) and prints the checks with stubs. It also takes into account child support and other stuff needed. I have a partly setup application to do the same in a5, but no where near complete. There were many of these apps distributed, but only one left. As you know, it is a lot of work for payroll.
Unlike others, I don't generally have problems with tables left open. Does not mean it can't happen, but some work to keep some stuff working right.
I don't like entering data in any kind of browse. It can lead to trouble, but it is sometimes necessary.
I think Charles app is not where the people can get to a computer to log in and out?. They obviously have no time clock? Most governing authorities require a signed time card for record keeping and time cards are available for a very small amount. Most businesses recognize the value once alerted to the need and time savings in the office. That is not to mention the errors corrected.
I do use xdialog. Maybe not to the point of other, but it is there. When a user signs in to my app, it is the first thing they see. I also use it heavy for my prints in the big app I have. The difference for me is that I don't push the limits of it like some do.
startup.png
Last edited by DaveM; 04-28-2014 at 02:21 PM.
Bookmarks