Perhaps this would better fit csupport.p9, but this feels more like
home. My "first time" was with Borland's Turbo Pascal database tools.
As commercial database software became more affordable I moved to dBase
and Paradox/DOS. I managed to avoid Windoze for many years, but when my
top client moved from Q&A to Access, so moved their data. Over the
years I've become fairly comfortable working with Access, but haven't
enjoyed it.
I just purchased Paradox 9, and spent much of the weekend getting
familiar with it. I regret to admit that Microsoft seems to provide
better 'help' information; I've already run into several issues which
I'm sure can be solved simply, but I haven't found the answers. Here's
hoping that someone here can spare a few moments to make my
re-introduction go more smoothly!
* Can the default value for a field (table structure) be set to be
calculated based on the value of another field? If not, will I
find the solution in form design, macros, PAL, where?
* How do I include a partial value as a default (area code for a
phone number picture) and not have the field selected on entry?
Having to deselect (e.g. right arrow) before typing the remainder
of the phone number makes me question the value of setting a default.
* Two questions on date fields.
1. How to get 'current year' to be default, so you only need to
enter the month/day...
2. How to display the date in mm/dd/yyyy format while able to
enter shorter date m/d/yy.
Sorry to hit you with what are surely fairly trivial problems, but at
some point one tires of hunting around for solutions when someone here
can surely point me in the right direction without blinking!
Thanks!
-Bob
1. Not in the table structure. You would do this as a calculated
field on the form/report. However, a calculated field cannot be
edited, so if you really just want it to _default_ to a certain
value and still allow the user to change the value, then you'll
want to use code to establish the default. Get back to us with
specifics for more help on this one.
2. Put in your default value (either use the table structure or
use code on the form), then, on arriving at the field you would
put it in field view (this positions the cursor at the end of the
existing value so you're ready to type). Do this in the field
object's arrive event:
self.postAction(EditEnterFieldView)
3. Use the spacebar for any part of a date which you want to
match today's date. Don't know of a way to just enter month/day
and then have year added as you leave the field (short of using
an unbound field, and appending year to the end of what was
entered and validating it as a date - bit more complex than
spacebar - let us know if you want more).
Welcome to Paradox for Windows, please drop by again any time -
and all questions are good questions!
Regards,
Liz
---
Get the lead out before you reply
Liz seems to have taken care of the specifics. I'll also suggest that you drop
by the Paradox resources page on our web site and, at minimum, download the
Database basics paper. This will save you from a lot of basic pitfalls. There
are a number of other good resources there and on the rest of our site as well.
both free and otherwise. Also check out our Partners and Links page. There are
lots of other good resources there. Particularly check out Lance Leonard's
Techtricks site and consider going to Vladimir Menkin's for his Proview which a
lot of folks swear by.
Denn Santoro
President
Resource Development Associates
http://www.RDAWorldWide.Com
375 High Street
Rochester, MA 02770
(508) 295-7350
and
Waldweg 5
83512 Reitmehring
Germany
08071 924271
Providing solutions to health care, business, governments and non-profits since
1982
Place 3 unbound fields: fldMonth, fldDay, fldYear. Put textboxes
between them with each textbox containing a "/" so the three fields plus
textboxes look like a date field on the form. Bob can then assign
values to any component of the date as desired.
Might be wise to group all elements so in the canDepart() method of the
group he can validate the date (exclude reason = ShutDownMove).
Have you tried a picture like this:
"[###,916]-###-####"
That should let you enter 916 (use the default of your choice) by pressing
the spacebar, or any other by entering the number.
----
Steve Caple [C-Tech Paradox]
> * Can the default value for a field (table structure) be set to be
> calculated based on the value of another field? If not, will I
> find the solution in form design, macros, PAL, where?
No, but it can be done with a little OPAL code. Basically, in the ARRIVE
method of that field, you set "self" to the "calculated field" value.
> * How do I include a partial value as a default (area code for a
> phone number picture) and not have the field selected on entry?
> Having to deselect (e.g. right arrow) before typing the
remainder
> of the phone number makes me question the value of setting a
default.
You can "replace" the default behavior by adding something in the
arrive method as well. I forgot the exact event, but you'll want to put
something in the arrive method. Have it execute the dodefault first,
get that all out the way, then execute the event that moves cursor to
the end while selecting mothing. I think it's editmoveend or something
like that. You can find the event.
> * Two questions on date fields.
> 1. How to get 'current year' to be default, so you only need
to
> enter the month/day...
Play with the depart method. Basically, look for slashes. If you see
only one slash, assume it's month and day. Validate both using
whatever method you wish (usually breakapart, though match is a
possibility), then append a slash and the string version of the current
year (year(dateval())) to the string, then cast that to a date.
> 2. How to display the date in mm/dd/yyyy format while able to
> enter shorter date m/d/yy.
You can enter m/d/yy with no problem, but it's not Y2K compliant. :-)
These are not trivial at all, it's basically a matter of "getting used
to"
the event bubbling and passing model.
--KC
Many of us have had problems with printing reports, like
printout coming in the wrong orientation, paper called for
letter instead of A4 etc. etc.
What seems to solve such problems (if you run into them)
is to make sure all measurements are set to centimeters
instead of inches when designing your reports. Curious?
well it has helped me for one.
regards Sven
"Bob McKeegan" <minority...@verizon.net> wrote in message
news:3A2B9656...@verizon.net...
> Greetings!
>
> Perhaps this would better fit csupport.p9, but this feels more like
> home. My "first time" was with Borland's Turbo Pascal database tools.
> As commercial database software became more affordable I moved to dBase
> and Paradox/DOS. I managed to avoid Windoze for many years, but when my
> top client moved from Q&A to Access, so moved their data. Over the
> years I've become fairly comfortable working with Access, but haven't
> enjoyed it.
>
> I just purchased Paradox 9, and spent much of the weekend getting
> familiar with it. I regret to admit that Microsoft seems to provide
> better 'help' information; I've already run into several issues which
> I'm sure can be solved simply, but I haven't found the answers. Here's
> hoping that someone here can spare a few moments to make my
> re-introduction go more smoothly!
>
> * Can the default value for a field (table structure) be set to be
> calculated based on the value of another field? If not, will I
> find the solution in form design, macros, PAL, where?
> * How do I include a partial value as a default (area code for a
> phone number picture) and not have the field selected on entry?
> Having to deselect (e.g. right arrow) before typing the remainder
> of the phone number makes me question the value of setting a
default.
> * Two questions on date fields.
>
> 1. How to get 'current year' to be default, so you only need to
> enter the month/day...
> 2. How to display the date in mm/dd/yyyy format while able to
> enter shorter date m/d/yy.
>
>
> These are not trivial at all, it's basically a matter of "getting used
> to" the event bubbling and passing model.
It may be a while before I reach that point! Starting out with new
software I like to get a feel for the intrinsic features and behavior
before I'm feeling ready to deal with objects and methods here. The
help getting used to how Paradox works is great for the moment.
Apparently for the default I'll need to dip my toe in OPAL, since the
idea is to 'guess' a date field based on another one in the record. The
self.postAction(EditEnterFieldView) tip should solve the frustration
with the area code. The spacebar tip is welcome, too. In Access in a
form or query you can enter m/d and exit the field and the year is
assumed to be current. While Microsoft frequently pisses me off by
making assumptions about what I want, in this case it's fairly safe that
if I wanted a different year I'd have entered it. Don't worry, though,
friends, I'm already loving Paradox, and with your help getting past the
occasional newbie frustration we should have a long happy relationship!
-Bob
Liz wrote:
FYI, if you create a display format showing only the month and
day (right click on field, Properties, Format tab), then the user
only has to enter month and day, and the computer does assume
year (I won't go so far as to say it assumes current year every
time, but that's what _appears_ to happen in limited testing).
The problem with this is that it does NOT allow you to enter the
year - if you do, you can't leave the field and get an invalid
character message...
So other than these two options, it gets a bit more complicated
to assume year...
Regards,
Liz
---
Get the lead out before you reply
-Bob
If you really like that behavior try this:
In the keyphysical method of the data field:
var
kePressSpace keyevent
endvar
if eventinfo.vchar() = "VK_Return" then
kePressSpace.setvchar("VK_Spacebar") ;//could be wrong on this constant
;//it is off
the top of my head
self.keyphysical(kePressSpace)
dodefault
endif
This should capture the enter, press the spacebar (setting the year) and
then move you on. You probably want to put error trapping in in case they
have not completed the field with month and day when they hit enter.
HTH
Denn Santoro
President
Resource Development Associates
http://www.RDAWorldWide.Com
375 High Street
Rochester, MA 02770
(508) 295-7350
and
Waldweg 5
83512 Reitmehring
Germany
08071 924271
Providing solutions to health care, business, governments and non-profits
since 1982
I think this is a little better than the keyPhysical method - it
goes in the date field's changeValue event:
try
date(eventInfo.newValue())
onFail
eventInfo.setNewValue(eventInfo.newValue() + "." +
string(year(today())))
endTry
It will be triggered by trying to post the record or by trying to
leave the field (pressing Enter, Tab, up or down arrows, using
navigation bar to move to a new record, leaving edit mode, etc.).
It works whether the user entered a year separator or not (oddly
enough). If the user enters a year, this code does nothing (so
the date the user entered sticks).
Tested in v8.
Regards,
Liz
---
Get the lead out before you reply
Bob wrote:
For all countries using a yyyy.mm.dd format, such a solution would be no
help at all.
And what's worse, all programmatic solutions to the problem will build a new
Y2K problem the day your country decides to accept the ISO date format.
--
Bertil Isberg CTECH
read the newsgroup: corelsupport.faqs.paradox
for Frequently Asked Questions
---------------------------------------------------
Bob <vw...@bellatlantic.net> skrev i
diskussionsgruppsmeddelandet:3A2DA11B...@bellatlantic.net...
> Interesting... As I mentioned, I don't care much for the Microsoft
> philosophy of programming, but in this case I have to hand it to them.
> In several years working with MS Access I've just gotten used to being
> able to enter d/m-[enter], so having to enter the year (or even [space])
> seems like a chore. Perhaps if I make an issue of it, someone will
> craft a slick and stable solution, or P10 will address it...
>
> -Bob
>
> Liz wrote:
>
> > Bob,
> >
> > FYI, if you create a display format showing only the month and
> > day (right click on field, Properties, Format tab), then the user
> > only has to enter month and day, and the computer does assume
> > year (I won't go so far as to say it assumes current year every
> > time, but that's what _appears_ to happen in limited testing).
> > The problem with this is that it does NOT allow you to enter the
> > year - if you do, you can't leave the field and get an invalid
> > character message...
> >
> > So other than these two options, it gets a bit more complicated
> > to assume year...
> >
-Bob
Dennis Santoro wrote:
Liz wrote:
> Bob,
>
> I think this is a little better than the keyPhysical method - it
> goes in the date field's changeValue event:
>
> try
> date(eventInfo.newValue())
> onFail
> eventInfo.setNewValue(eventInfo.newValue() + "." +
> string(year(today())))
> endTry
>
> It will be triggered by trying to post the record or by trying to
> leave the field (pressing Enter, Tab, up or down arrows, using
> navigation bar to move to a new record, leaving edit mode, etc.).
>
> It works whether the user entered a year separator or not (oddly
> enough). If the user enters a year, this code does nothing (so
> the date the user entered sticks).
>
> Tested in v8.
>
> Regards,
>
> Liz
> ---
> Get the lead out before you reply
>
>
>
For when/if you decide to try getting your date field to behave
as desired...
First, Bertil's comments should be seriously considered.
(Personally, my users would never get such a feature - they would
always be forced to enter all 4-digits for the year (or at least
enter 2 and see all 4 when you leave the field) and if they
didn't like it I'd tell them tough luck. Assumptions just cause
problems, and led us to the whole Y2K 'crisis' in the first
place.)
If you already know how to add code, just ignore this
paragraph... That said, in form design, select this date field
we're talking about by clicking on it until it's the selected
object. Please note, that if your field is of the "Labeled"
type, it is a container for two other objects - a text object
(the label) and an edit region (this is the area where the cursor
goes and where values are entered, but it is _not_ the field
object). So, select the field object, right click on it, select
Object Explorer from the pop-up menu, select the Events tab (in
said Object Explorer), double click on the changeValue event and
copy and paste the code I gave you between the existing
method..endMethod lines. The code shouldn't need any
alteration. If you don't see changeValue listed on the Events
tab, go to Tools > Settings > Developer Preferences; General tab
and select Advanced under ObjectPAL level, also, check the Show
developer menus box. OK out of this dialog, and repeat the above
steps.
We hate to leave problems unsolved here. And we like to
encourage new users.
Regards,
Liz
---
Get the lead out before you reply
The USA will be switching to the ISO date formats very soon.... right after
we finish the conversion to metric :)
Rick Kelly
Crooit Software
http://www.crooit.com
"Bertil Isberg" <bertil...@nospam.telia.com> wrote in message
news:3a2fb81e@cnews...
> And right after you know which president was elected by you:-)
>
> --
> Bertil Isberg CTECH
> read the newsgroup: corelsupport.faqs.paradox
> for Frequently Asked Questions
> ---------------------------------------------------
> Wayne Sheppard <mrw...@mindspring.com> skrev i
> diskussionsgruppsmeddelandet:3a2f9fc0@cnews...
So when you've got a new system for election of the president, you also have
to face to the conversion to metric and ISO-date. Maybe you've better stick
to the current system. :-)
--
Bertil Isberg CTECH
read the newsgroup: corelsupport.faqs.paradox
for Frequently Asked Questions
---------------------------------------------------
Steve Caple <ct...@corel.com> skrev i
diskussionsgruppsmeddelandet:MPG.14995dca3...@cnews.corel.com...
> Bertil Isberg wrote:
> > And right after you know which president was elected by you:-)
>
> Actually, we do, but Shrub, having lost by 337,000+, doesn't want a
complete
> count to prove it.
>
> Steve
> ------
>
> BU--SH-- - half a word, half a wit, half a loafer isn't better than none
Denn Santoro
President
Resource Development Associates
http://www.RDAWorldWide.Com
375 High Street
Rochester, MA 02770
(508) 295-7350
and
Waldweg 5
83512 Reitmehring
Germany
08071 924271
Providing solutions to health care, business, governments and non-profits since
1982
My wife is lobbying for a
Jed Bartlett
is my President
bumpersticker. Me, I'll stick to Frank Zappa.
Steve