powerh-l Digest, Vol 165, Issue 1
Ken Langendock
ken at langendock.com
Thu Dec 8 14:01:36 CST 2022
Here is what I have used in the past.
See the copy module that has all the code required to change date formatting.
;From my standard copy module used thru out the system I define the date format
TEMP T-DateFormat CHARACTER * 1 &
RESET AT STARTUP &
;INITIAL T-Security[100:1]
INITIAL " " ;American
In the INPUT procedure I simply call this based on the Dictionary format:
PROCEDURE INPUT T-SelectDateFrom
BEGIN
DO INTERNAL INPUT-MMDDYYYY
END
Hope this helps steer you in the right direction:
Ken
-----Original Message-----
From: powerh-l [mailto:powerh-l-bounces at lists.sowder.com] On Behalf Of powerh-l-request at lists.sowder.com
Sent: December 8, 2022 2:03 PM
To: powerh-l at lists.sowder.com
Subject: powerh-l Digest, Vol 165, Issue 1
Send powerh-l mailing list submissions to
powerh-l at lists.sowder.com
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sowder.com/mailman/listinfo/powerh-l
or, via email, send a message with subject or body 'help' to
powerh-l-request at lists.sowder.com
You can reach the person managing the list at
powerh-l-owner at lists.sowder.com
When replying, please edit your Subject line so it is more specific
than "Re: Contents of powerh-l digest..."
Today's Topics:
1. Multiple date input formats for QUICK (James B. Byrne)
2. Re:Multiple date input formats for QUICK (RUTMJVA)
3. Re:Multiple date input formats for QUICK (Robert Deskin)
4. Re:Multiple date input formats for QUICK (RUTMJVA)
----------------------------------------------------------------------
Message: 1
Date: Thu, 8 Dec 2022 13:02:15 -0500
From: "James B. Byrne" <byrnejb at harte-lyne.ca>
To: powerh-l at lists.sowder.com
Subject: Multiple date input formats for QUICK
Message-ID:
<70516d938d46eb8e4dd0011212145e0b.squirrel at webmail.harte-lyne.ca>
Content-Type: text/plain;charset=iso-8859-1
PH839
I have a request to allow users to input dates as in any of the following forms:
yyyymmdd
yyyy.mm.dd
yyyy-mm-dd
yyyy/mm/dd
To handle this I tried the following:
FIELD INPUT-DATE OF TRANSACTIONS
PROCEDURE INPUT INPUT-DATE
BEGIN
LET QKT-TEXT=TRUNCATE(LJ(FIELDTEXT))
IF MATCHPATTERN(QKT-TEXT,"####.##.##") OR &
MATCHPATTERN(QKT-TEXT,"####-##-##") OR &
MATCHPATTERN(QKT-TEXT,"####/##/##")
THEN LET FIELDTEXT = QKT-TEXT[1:4]+QKT-TEXT[6:2]+QKT-TEXT[9:2]
END
Which does not work. If yyyy.mm.dd is input then the error " This entry must
be a date." appears. I speculate that this means that the FIELDVALUE is not
being changed as a result of manipulating FIELDTEXT.
SO, is there any way to implement this feature and if so then what is it?
--
*** e-Mail is NOT a SECURE channel ***
Do NOT transmit sensitive data via e-Mail
Unencrypted messages have no legal claim to privacy
Do NOT open attachments nor follow links sent by e-Mail
James B. Byrne mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3
------------------------------
Message: 2
Date: Thu, 8 Dec 2022 13:15:13 -0500
From: RUTMJVA <tmjva23664 at gmail.com>
To: powerh-l at lists.sowder.com, byrnejb at harte-lyne.ca
Subject: Re: Multiple date input formats for QUICK
Message-ID: <ec94753c-a9ea-62c2-73c0-4754ac42b39f at gmail.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
If this is quick, my guess this is also a screen.
Don't give users ideas.� Give them 3 defined fields:� yyyy, mm,� and� dd
Then separate the fields with a character of the programmer's choice.
They won't be able to touch that character, either dots, dashes, or
slashes, they are simply displayed between fields.
Then behind the scenes, concatenate the three fields together into a new
field to make a date.
On 12/8/22 13:02, James B. Byrne wrote:
> PH839
>
> I have a request to allow users to input dates as in any of the following forms:
> yyyymmdd
> yyyy.mm.dd
> yyyy-mm-dd
> yyyy/mm/dd
>
> To handle this I tried the following:
>
> FIELD INPUT-DATE OF TRANSACTIONS
>
> PROCEDURE INPUT INPUT-DATE
> BEGIN
> LET QKT-TEXT=TRUNCATE(LJ(FIELDTEXT))
> IF MATCHPATTERN(QKT-TEXT,"####.##.##") OR &
> MATCHPATTERN(QKT-TEXT,"####-##-##") OR &
> MATCHPATTERN(QKT-TEXT,"####/##/##")
> THEN LET FIELDTEXT = QKT-TEXT[1:4]+QKT-TEXT[6:2]+QKT-TEXT[9:2]
> END
>
> Which does not work. If yyyy.mm.dd is input then the error " This entry must
> be a date." appears. I speculate that this means that the FIELDVALUE is not
> being changed as a result of manipulating FIELDTEXT.
>
> SO, is there any way to implement this feature and if so then what is it?
>
--
Tracy Johnson
BT
NNNN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sowder.com/pipermail/powerh-l/attachments/20221208/37a6ac27/attachment-0001.html>
------------------------------
Message: 3
Date: Thu, 8 Dec 2022 13:39:55 -0500
From: Robert Deskin <bob.deskin at me.com>
To: "James B. Byrne" <byrnejb at harte-lyne.ca>
Cc: PowerHouse List <powerh-l at lists.sowder.com>
Subject: Re: Multiple date input formats for QUICK
Message-ID: <542097E6-230C-4428-966F-8FB52A8D09DF at me.com>
Content-Type: text/plain; charset="utf-8"
While I agree with the previous reply to not allow that much flexibility, if your users insist, then don�t make this a date field, make it a text field. Unfortunately, I don�t believe that QUICK will allow multiple date input formats. Take the text, extract the date, and issue an error if it�s not a valid date field. Of course to properly test whether it�s a valid date, you�ll have to check the month value and the corresponding correct day value. And don�t forget about Y2K rules.
Much easier to restrict what they can enter. Note that they can enter a date with or without the separator, but it must be the separator specified either in the dictionary or on the FIELD statement.
Bob
> On Dec 8, 2022, at 1:15 PM, RUTMJVA <tmjva23664 at gmail.com> wrote:
>
> If this is quick, my guess this is also a screen.
>
> Don't give users ideas. Give them 3 defined fields: yyyy, mm, and dd
>
> Then separate the fields with a character of the programmer's choice.
>
> They won't be able to touch that character, either dots, dashes, or slashes, they are simply displayed between fields.
>
> Then behind the scenes, concatenate the three fields together into a new field to make a date.
>
> On 12/8/22 13:02, James B. Byrne wrote:
>> PH839
>>
>> I have a request to allow users to input dates as in any of the following forms:
>> yyyymmdd
>> yyyy.mm.dd
>> yyyy-mm-dd
>> yyyy/mm/dd
>>
>> To handle this I tried the following:
>>
>> FIELD INPUT-DATE OF TRANSACTIONS
>>
>> PROCEDURE INPUT INPUT-DATE
>> BEGIN
>> LET QKT-TEXT=TRUNCATE(LJ(FIELDTEXT))
>> IF MATCHPATTERN(QKT-TEXT,"####.##.##") OR &
>> MATCHPATTERN(QKT-TEXT,"####-##-##") OR &
>> MATCHPATTERN(QKT-TEXT,"####/##/##")
>> THEN LET FIELDTEXT = QKT-TEXT[1:4]+QKT-TEXT[6:2]+QKT-TEXT[9:2]
>> END
>>
>> Which does not work. If yyyy.mm.dd is input then the error " This entry must
>> be a date." appears. I speculate that this means that the FIELDVALUE is not
>> being changed as a result of manipulating FIELDTEXT.
>>
>> SO, is there any way to implement this feature and if so then what is it?
>>
>
> --
> Tracy Johnson
> BT
>
>
>
>
>
>
>
> NNNN
> --
> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> Mailing list: powerh-l at lists.sowder.com
> Subscribe: 'subscribe' in message body to powerh-l-request at lists.sowder.com
> Unsubscribe: 'unsubscribe <password>' in message body to powerh-l-request at lists.sowder.com
> https://lists.sowder.com/mailman/listinfo/powerh-l
> This list is closed, thus to post to the list you must be a subscriber.
> Add 'site:lists.sowder.com powerh-l' to your search terms to search the list archive at Google.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sowder.com/pipermail/powerh-l/attachments/20221208/1879766e/attachment-0001.html>
------------------------------
Message: 4
Date: Thu, 8 Dec 2022 14:02:33 -0500
From: RUTMJVA <tmjva23664 at gmail.com>
To: Robert Deskin <bob.deskin at me.com>, "James B. Byrne"
<byrnejb at harte-lyne.ca>
Cc: PowerHouse List <powerh-l at lists.sowder.com>
Subject: Re: Multiple date input formats for QUICK
Message-ID: <b008bc1e-7954-d462-6358-1a3f2ca686ea at gmail.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
To thrown a monkey wrench into it, the users may also want a space
delimiter, heh, heh, heh.
Which reminds me of the original MANMAN command line (xx,nnn). VAX
allowed a dot or a space, HP3000 was a comma, then one day in a later
version they decided to let both systems use either 3 delimiters.
On 12/8/22 13:39, Robert Deskin wrote:
> While I agree with the previous reply to not allow that much
> flexibility, if your users insist, then don�t make this a date field,
> make it a text field. Unfortunately, I don�t believe that QUICK will
> allow multiple date input formats. Take the text, extract the date,
> and issue an error if it�s not a valid date field. Of course to
> properly test whether it�s a valid date, you�ll have to check the
> month value and the corresponding correct day value. And don�t forget
> about Y2K rules.
>
> Much easier to restrict what they can enter. Note that they can enter
> a date with or without the separator, but it must be the separator
> specified either in the dictionary or on the FIELD statement.
>
> Bob
>
>> On Dec 8, 2022, at 1:15 PM, RUTMJVA <tmjva23664 at gmail.com> wrote:
>>
>> If this is quick, my guess this is also a screen.
>>
>> Don't give users ideas.� Give them 3 defined fields:� yyyy,� mm,� and� dd
>>
>> Then separate the fields with a character of the programmer's choice.
>>
>> They won't be able to touch that character, either dots, dashes, or
>> slashes, they are simply displayed between fields.
>>
>> Then behind the scenes, concatenate the three fields together into a
>> new field to make a date.
>>
>> On 12/8/22 13:02, James B. Byrne wrote:
>>> PH839
>>>
>>> I have a request to allow users to input dates as in any of the following forms:
>>> yyyymmdd
>>> yyyy.mm.dd
>>> yyyy-mm-dd
>>> yyyy/mm/dd
>>>
>>> To handle this I tried the following:
>>>
>>> FIELD INPUT-DATE OF TRANSACTIONS
>>>
>>> PROCEDURE INPUT INPUT-DATE
>>> BEGIN
>>> LET QKT-TEXT=TRUNCATE(LJ(FIELDTEXT))
>>> IF MATCHPATTERN(QKT-TEXT,"####.##.##") OR &
>>> MATCHPATTERN(QKT-TEXT,"####-##-##") OR &
>>> MATCHPATTERN(QKT-TEXT,"####/##/##")
>>> THEN LET FIELDTEXT = QKT-TEXT[1:4]+QKT-TEXT[6:2]+QKT-TEXT[9:2]
>>> END
>>>
>>> Which does not work. If yyyy.mm.dd is input then the error " This entry must
>>> be a date." appears. I speculate that this means that the FIELDVALUE is not
>>> being changed as a result of manipulating FIELDTEXT.
>>>
>>> SO, is there any way to implement this feature and if so then what is it?
>>>
>>
>> --
>> Tracy Johnson
>> BT
>>
>>
>>
>>
>>
>>
>>
>> NNNN
>> --
>> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
>> Mailing list: powerh-l at lists.sowder.com
>> Subscribe: 'subscribe' in message body to
>> powerh-l-request at lists.sowder.com
>> Unsubscribe: 'unsubscribe <password>' in message body to
>> powerh-l-request at lists.sowder.com
>> https://lists.sowder.com/mailman/listinfo/powerh-l
>> This list is closed, thus to post to the list you must be a subscriber.
>> Add 'site:lists.sowder.com powerh-l' to your search terms to search
>> the list archive at Google.
>
--
Tracy Johnson
BT
NNNN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sowder.com/pipermail/powerh-l/attachments/20221208/9c0e45ce/attachment.html>
------------------------------
Subject: Digest Footer
--
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l at lists.sowder.com
Subscribe: "subscribe" in message body to powerh-l-request at lists.sowder.com
Unsubscribe: "unsubscribe <password>" in message body to powerh-l-request at lists.sowder.com
https://lists.sowder.com/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
Add 'site:lists.sowder.com powerh-l' to your search terms to search the list archive at Google.
------------------------------
End of powerh-l Digest, Vol 165, Issue 1
****************************************
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inptdate.use
Type: application/octet-stream
Size: 7774 bytes
Desc: not available
URL: <http://lists.sowder.com/pipermail/powerh-l/attachments/20221208/d54fa62f/attachment.obj>
More information about the powerh-l
mailing list