on 05-02-2023 7:03 PM
Hello All. I've been given CR to learn and would like to know the purpose of some things in the following string:
cdate(Mid ( Totext ({sample.datefield},0,''),5,2) + '/' + Right( Totext ({sample.datefield},0,''),2) + '/' + Left ( Totext ({sample.datefield},0,''),4))
This formula produces the following string in output: 05/02/2023. What is the purpose of the {samle.date} Mid Right and Left? What does the ,0, or ,5,2 do?
Thank you all for your time.
You could find most of this information in the Crystal Help, which is actually quite good.
{sample.datefield} supposedly is a date field, but from the formula I suspect that it's actually a number in the format yyyymmdd.
ToText({sample.datefield}, 0, "") converts the number to a string with no decimal places (specified by the 0) and no commas (specified by the "").
Mid(<string>, 5, 2) gets a substring starting at the 5th character, returning 2 characters. So the "mm" part of the yyyymmdd string.
Right(<string>, 2) gets the two characters at the end of the string.
Left(<string>, 4) gets the four characters at the beginning of the string.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.