Getting left and right expression values
Stanley - stanlyn-com
stanley at stanlyn.com
Mon Apr 23 20:59:46 PDT 2012
Hi Bruce,
I use this sort of stuff all the time now and don't know why in all the
years of filePro programming that I've done, I never used this level of
functionality in filePro. It was visual foxpro that opened my eyes to
hundreds of date, datetime, time and string functions. I am doing a little
fp work now and I'm reaching for foxpro to filePro functions, and finding
out there is so much functionality missing from filePro, compared to what
I've been using for the last 12 years...
MS SQL Server also offers a large array of date, time and string functions.
In this datetime example, I am using the approach you suggested and if I
need to do date math on it, I just assign it to a variable with the date
datatype, like aa(yymd/,10).
> There is no 'right' function in filepro
This is a real bummer? Is there an easy way to get the time part of these 2
strings?
1. "Error 123, The prob is in customers... 20120423 0412"
2. "Error 33, Bad Index... 20120521 0322"
It appears that a trim is implied, but the problem is knowing where the time
part is. If we could read from the trimmed variable/field right side, then
it would be easy...
> why are you combining a date and time into one field
Simple, it's all in one field, and if you had left and right functions then
getting at any of its data is simple and fast and much easier to maintain
than 2 separate fields. Also note that what I'm saying here is useful for
any string and date time data types, as I previously mentioned it's easy to
convert a string to a date or time types.
Also, another reason is that I'm out of automatic indexes... As A-P is
SEVERELY limiting...
Is there any of getting seconds into the time part as in "11:25:50"?
Thanks, Stanley
-----Original Message-----
From: filepro-list-bounces+stanley=stanlyn.com at lists.celestial.com
[mailto:filepro-list-bounces+stanley=stanlyn.com at lists.celestial.com] On
Behalf Of Bruce Easton
Sent: Monday, April 23, 2012 11:14 PM
To: filepro-list at lists.celestial.com
Subject: Re: Getting left and right expression values
Stanley,
There is no 'right' function in filepro. filepro's 'mid()', as Ken said,
can take care of all of your needs for extracting part of a string. You can
also use a dummy or long-variable field declared with a specific length to
effectively truncate a field at the desired point (and give you a 'left'
part):
Then: declare dateportion(10,*)
Then: dateportion = datetimefield
Just curious, but possibly more importantly, why are you combining a date
and time into one field? With filepro's turbo-charged, other-worldy
abilities to sort and do math on dates and times as separate and special
data types, why ever do that? Maybe many years ago when, in
filepro, you could not create auto indexes on non-contiguous fields, but....
Or maybe I misunderstood and you are not actually storing the data that
way....
Bruce
Bruce Easton
STN, Inc.
On 4/23/12 10:30 PM, Stanley - stanlyn-com wrote:
> Hi Ken,
>
>> Use MID(), which is the equivalent of your substr() example.
> OK, yes I see that, and thanks...
>
> Now, what about the left and right functions? How would you get those
> parts out of a string?
>
> Thanks, Stanley
>
>
>
>
>
>
>
> -----Original Message-----
> From: Kenneth Brody [mailto:kenbrody at spamcop.net]
> Sent: Monday, April 23, 2012 10:21 PM
> To: Stanley - stanlyn-com
> Cc: Filepro-list at lists.celestial.com
> Subject: Re: Getting left and right expression values
>
> On 4/23/2012 9:49 PM, Stanley - stanlyn-com wrote:
>> Hi,
> [...]
>> How do I get just the date part and/or the time part? In the other
>> languages I use we have a left and right functions that returns
>> values from the left or right as in:
> [...]
>> Also what about a function that would return a string starting at a
>> known position and for x number of characters, such as
>> lcString=substr(datetimefield, 7,6) where lcString would be equal to
>> "4/23 2"
>>
>> I use this kind of stuff all the time in other languages and don't
>> see any easy way of doing it in filePro.
> [...]
>
> Use MID(), which is the equivalent of your substr() example.
>
> --
> Kenneth Brody
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
_______________________________________________
Filepro-list mailing list
Filepro-list at lists.celestial.com
Subscribe/Unsubscribe/Subscription Changes
http://mailman.celestial.com/mailman/listinfo/filepro-list
More information about the Filepro-list
mailing list